blob: d934c2debf0d15df8da70b9fe76bed93d3370787 [file] [log] [blame]
---
# file: roles/head-prep/tasks/main.yml
- name: Install prerequisites for using PPA repos
apt:
name={{ item }}
update_cache=yes
with_items:
- python-pycurl
- software-properties-common
- name: Add Ansible/Juju repositories
apt_repository:
repo={{ item }}
with_items:
- "{{ juju_apt_repo | default('ppa:juju/stable') }}"
# - "{{ ansible_apt_repo | default('ppa:ansible/ansible') }}"
register: result
until: result | success
retries: 3
delay: 10
- name: Install packages
apt:
name={{ item }}
state=present
update_cache=yes
with_items:
- uvtool
- git
- bzr
- juju-core
- python-pip
- python-novaclient
- python-neutronclient
- python-keystoneclient
- python-glanceclient
- python-lxml
- virt-top
- libssl-dev
- python-dev
- sshpass
- name: Install Ansible via pip
pip: name=ansible version=2.2.2.0
# - name: Make sure Ansible is newest version
# apt:
# name: "ansible"
# state: latest
# update_cache: yes
# cache_valid_time: 3600
# tags:
# - skip_ansible_lint # ansible-lint complains about latest, need this or old built in 1.5.x version may be used if already installed.
- name: Install Python packages
pip:
name={{ item}}
state=present
with_items:
- urllib3
- pyopenssl
- ndg-httpsclient
- pyasn1
- name: Prep user account by adding to libvirtd group and generating SSH key
user:
name={{ ansible_user_id }}
generate_ssh_key=yes
groups="libvirtd" append=yes
- name: Register public key in variable
shell: cat {{ ansible_user_dir }}/.ssh/id_rsa.pub
register: sshkey
tags:
- skip_ansible_lint # FIXME: this should be done a different way
- name: Add public key to this user account
authorized_key:
user={{ ansible_user_id }}
key="{{ sshkey.stdout }}"
- name: Disable host key checking in ~/.ssh/config
lineinfile:
dest={{ ansible_user_dir }}/.ssh/config
line="StrictHostKeyChecking no"
create=yes
owner={{ ansible_user_id }} mode=0600
- name: Disable host key checking in ~/.ansible.cfg
copy:
src=ansible.cfg
dest={{ ansible_user_dir }}/.ansible.cfg
owner={{ ansible_user_id }} mode=0644