| --- |
| # file: roles/head-prep/tasks/main.yml |
| |
| - name: Install prerequisites for using PPA repos |
| apt: |
| name={{ item }} |
| 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=latest |
| update_cache=yes |
| with_items: |
| - ansible |
| - uvtool |
| - git |
| - bzr |
| - juju-core |
| - python-novaclient |
| - python-neutronclient |
| - python-keystoneclient |
| - python-glanceclient |
| - virt-top |
| |
| - name: Obtain the juju-ansible tool from github |
| git: |
| repo=https://github.com/cmars/juju-ansible.git |
| dest=/usr/local/src/juju-ansible |
| version="HEAD" |
| |
| - name: Create symlinks to the juju-ansible tool |
| file: |
| src=/usr/local/src/juju-ansible/juju-ansible |
| dest={{ item }} |
| state=link |
| with_items: |
| - "/usr/local/bin/juju-ansible" |
| - "/usr/local/bin/juju-ansible-playbook" |
| |
| - 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 |
| |
| - name: Add public key to this user account |
| authorized_key: |
| user={{ ansible_user_id }} |
| key="{{ sshkey.stdout }}" |
| |