blob: f495b22c440a80ee74fad4fa88f0cd3646477840 [file] [log] [blame]
Zack Williams8625d042016-02-26 14:32:43 -07001---
2# file: roles/head-prep/tasks/main.yml
3
4- name: Install prerequisites for using PPA repos
5 apt:
6 name={{ item }}
Zack Williams7ec058b2016-05-02 10:10:39 -07007 update_cache=yes
8 cache_valid_time=3600
Zack Williams8625d042016-02-26 14:32:43 -07009 with_items:
10 - python-pycurl
11 - software-properties-common
12
13- name: Add Ansible/Juju repositories
14 apt_repository:
15 repo={{ item }}
16 with_items:
17 - "ppa:juju/stable"
18 - "ppa:ansible/ansible"
19
20- name: Install packages
21 apt:
22 name={{ item }}
Zack Williams9d2c6e12016-08-10 15:38:43 -070023 state=present
Zack Williams8625d042016-02-26 14:32:43 -070024 update_cache=yes
Zack Williams1320e1f2016-05-02 09:54:08 -070025 cache_valid_time=3600
Zack Williams8625d042016-02-26 14:32:43 -070026 with_items:
27 - ansible
28 - uvtool
29 - git
30 - bzr
31 - juju-core
32 - python-novaclient
33 - python-neutronclient
34 - python-keystoneclient
35 - python-glanceclient
Zack Williams709f11b2016-03-17 14:29:51 -070036 - virt-top
Zack Williams8625d042016-02-26 14:32:43 -070037
Zack Williams709f11b2016-03-17 14:29:51 -070038- name: Prep user account by adding to libvirtd group and generating SSH key
Zack Williams8625d042016-02-26 14:32:43 -070039 user:
Zack Williams9cdf8622016-02-26 22:42:50 -070040 name={{ ansible_user_id }}
Zack Williams8625d042016-02-26 14:32:43 -070041 generate_ssh_key=yes
42 groups="libvirtd" append=yes
43
Zack Williams9d2c6e12016-08-10 15:38:43 -070044# FIXME: this should be changed per http://docs.ansible.com/ansible/playbooks_lookups.html#intro-to-lookups-getting-file-contents
Zack Williams709f11b2016-03-17 14:29:51 -070045- name: Register public key in variable
Zack Williams9cdf8622016-02-26 22:42:50 -070046 shell: cat {{ ansible_user_dir }}/.ssh/id_rsa.pub
Zack Williams8625d042016-02-26 14:32:43 -070047 register: sshkey
48
Zack Williams709f11b2016-03-17 14:29:51 -070049- name: Add public key to this user account
Zack Williams8625d042016-02-26 14:32:43 -070050 authorized_key:
Zack Williams9cdf8622016-02-26 22:42:50 -070051 user={{ ansible_user_id }}
Zack Williams8625d042016-02-26 14:32:43 -070052 key="{{ sshkey.stdout }}"
53
Zack Williams2cffa0f2016-05-20 12:18:47 -070054- name: Disable host key checking in ~/.ssh/config
55 lineinfile:
56 dest={{ ansible_user_dir }}/.ssh/config
57 line="StrictHostKeyChecking no"
58 create=yes
59 owner={{ ansible_user_id }} mode=0600
60
61- name: Disable host key checking in ~/.ansible.cfg
62 copy:
63 src=ansible.cfg
64 dest={{ ansible_user_dir }}/.ansible.cfg
65 owner={{ ansible_user_id }} mode=0644
66