blob: a858ce34cad46ab95b089dd8a562ae37be3f26db [file] [log] [blame]
---
# file: roles/head-prep/tasks/main.yml
- name: Install prerequisites for using PPA repos
apt:
name={{ item }}
update_cache=yes
cache_valid_time=3600
with_items:
- python-pycurl
- software-properties-common
- name: Add Ansible/Juju repositories
apt_repository:
repo={{ item }}
with_items:
- "ppa:juju/stable"
- "ppa:ansible/ansible"
- name: Install packages
apt:
name={{ item }}
state=present
update_cache=yes
cache_valid_time=3600
with_items:
- ansible
- uvtool
- git
- bzr
- juju-core
- python-novaclient
- python-neutronclient
- python-keystoneclient
- python-glanceclient
- python-lxml
- virt-top
- 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
# FIXME: this should be changed per http://docs.ansible.com/ansible/playbooks_lookups.html#intro-to-lookups-getting-file-contents
- name: Register public key in variable
shell: cat {{ ansible_user_dir }}/.ssh/id_rsa.pub
register: sshkey
- 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
- name: Copy node key (MaaS)
copy:
src={{ maas_node_key }}
dest={{ ansible_user_dir }}/node_key
owner={{ ansible_user }}
mode=0600
remote_src=True
when: on_maas
- name: Copy node key (without MaaS)
copy:
src={{ ansible_user_dir }}/.ssh/id_rsa
dest={{ ansible_user_dir }}/node_key
owner={{ ansible_user }}
mode=0600
remote_src=True
when: not on_maas