blob: d934c2debf0d15df8da70b9fe76bed93d3370787 [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
Zack Williams8625d042016-02-26 14:32:43 -07008 with_items:
9 - python-pycurl
10 - software-properties-common
11
12- name: Add Ansible/Juju repositories
13 apt_repository:
14 repo={{ item }}
15 with_items:
David K. Bainbridge77a516a2016-10-27 10:57:57 -070016 - "{{ juju_apt_repo | default('ppa:juju/stable') }}"
Sapan Bhatia96426ec2017-04-13 19:41:04 -070017 # - "{{ ansible_apt_repo | default('ppa:ansible/ansible') }}"
Andy Bavier8cbc1f82017-02-24 16:35:39 -050018 register: result
19 until: result | success
20 retries: 3
21 delay: 10
Zack Williams8625d042016-02-26 14:32:43 -070022
23- name: Install packages
24 apt:
25 name={{ item }}
Zack Williamsb6bf2ec2016-08-10 15:38:43 -070026 state=present
Zack Williams8625d042016-02-26 14:32:43 -070027 update_cache=yes
28 with_items:
Zack Williams8625d042016-02-26 14:32:43 -070029 - uvtool
30 - git
31 - bzr
32 - juju-core
Andy Bavier30d27c92016-09-15 15:59:17 -040033 - python-pip
Zack Williams8625d042016-02-26 14:32:43 -070034 - python-novaclient
35 - python-neutronclient
36 - python-keystoneclient
37 - python-glanceclient
Zack Williams2b946292016-08-22 15:32:29 -070038 - python-lxml
Zack Williams709f11b2016-03-17 14:29:51 -070039 - virt-top
Sapan Bhatia96426ec2017-04-13 19:41:04 -070040 - libssl-dev
41 - python-dev
42 - sshpass
Zack Williams8625d042016-02-26 14:32:43 -070043
Sapan Bhatia96426ec2017-04-13 19:41:04 -070044- name: Install Ansible via pip
45 pip: name=ansible version=2.2.2.0
46# - name: Make sure Ansible is newest version
47# apt:
48# name: "ansible"
49# state: latest
50# update_cache: yes
51# cache_valid_time: 3600
52# tags:
53# - skip_ansible_lint # ansible-lint complains about latest, need this or old built in 1.5.x version may be used if already installed.
Zack Williams682450e2016-11-19 09:04:41 -070054
Andy Bavier30d27c92016-09-15 15:59:17 -040055- name: Install Python packages
56 pip:
57 name={{ item}}
58 state=present
59 with_items:
60 - urllib3
61 - pyopenssl
62 - ndg-httpsclient
63 - pyasn1
64
Zack Williams709f11b2016-03-17 14:29:51 -070065- name: Prep user account by adding to libvirtd group and generating SSH key
Zack Williams8625d042016-02-26 14:32:43 -070066 user:
Zack Williams9cdf8622016-02-26 22:42:50 -070067 name={{ ansible_user_id }}
Zack Williams8625d042016-02-26 14:32:43 -070068 generate_ssh_key=yes
69 groups="libvirtd" append=yes
70
Zack Williams709f11b2016-03-17 14:29:51 -070071- name: Register public key in variable
Zack Williams9cdf8622016-02-26 22:42:50 -070072 shell: cat {{ ansible_user_dir }}/.ssh/id_rsa.pub
Zack Williams8625d042016-02-26 14:32:43 -070073 register: sshkey
Zack Williams35624562016-08-28 17:12:26 -070074 tags:
75 - skip_ansible_lint # FIXME: this should be done a different way
Zack Williams8625d042016-02-26 14:32:43 -070076
Zack Williams709f11b2016-03-17 14:29:51 -070077- name: Add public key to this user account
Zack Williams8625d042016-02-26 14:32:43 -070078 authorized_key:
Zack Williams9cdf8622016-02-26 22:42:50 -070079 user={{ ansible_user_id }}
Zack Williams8625d042016-02-26 14:32:43 -070080 key="{{ sshkey.stdout }}"
81
Zack Williams2cffa0f2016-05-20 12:18:47 -070082- name: Disable host key checking in ~/.ssh/config
83 lineinfile:
84 dest={{ ansible_user_dir }}/.ssh/config
85 line="StrictHostKeyChecking no"
86 create=yes
87 owner={{ ansible_user_id }} mode=0600
88
89- name: Disable host key checking in ~/.ansible.cfg
90 copy:
91 src=ansible.cfg
92 dest={{ ansible_user_dir }}/.ansible.cfg
93 owner={{ ansible_user_id }} mode=0644