Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 1 | --- |
| 2 | # file: roles/head-prep/tasks/main.yml |
| 3 | |
| 4 | - name: Install prerequisites for using PPA repos |
| 5 | apt: |
| 6 | name={{ item }} |
| 7 | with_items: |
| 8 | - python-pycurl |
| 9 | - software-properties-common |
| 10 | |
| 11 | - name: Add Ansible/Juju repositories |
| 12 | apt_repository: |
| 13 | repo={{ item }} |
| 14 | with_items: |
| 15 | - "ppa:juju/stable" |
| 16 | - "ppa:ansible/ansible" |
| 17 | |
| 18 | - name: Install packages |
| 19 | apt: |
| 20 | name={{ item }} |
| 21 | state=latest |
| 22 | update_cache=yes |
| 23 | with_items: |
| 24 | - ansible |
| 25 | - uvtool |
| 26 | - git |
| 27 | - bzr |
| 28 | - juju-core |
| 29 | - python-novaclient |
| 30 | - python-neutronclient |
| 31 | - python-keystoneclient |
| 32 | - python-glanceclient |
| 33 | |
| 34 | - name: Obtain the juju-ansible tool from github |
| 35 | git: |
| 36 | repo=https://github.com/cmars/juju-ansible.git |
| 37 | dest=/usr/local/src/juju-ansible |
| 38 | version="HEAD" |
| 39 | |
| 40 | - name: Create symlinks to the juju-ansible tool |
| 41 | file: |
| 42 | src=/usr/local/src/juju-ansible/juju-ansible |
| 43 | dest={{ item }} |
| 44 | state=link |
| 45 | with_items: |
| 46 | - "/usr/local/bin/juju-ansible" |
| 47 | - "/usr/local/bin/juju-ansible-playbook" |
| 48 | |
| 49 | - name: Prepare user account and generate SSH key |
| 50 | user: |
| 51 | name={{ ansible_env['SUDO_USER'] }} |
| 52 | generate_ssh_key=yes |
| 53 | groups="libvirtd" append=yes |
| 54 | |
| 55 | - name: Get public key |
| 56 | shell: cat {{ ansible_env['PWD'] }}/.ssh/id_rsa.pub |
| 57 | register: sshkey |
| 58 | |
| 59 | - name: Add key to this user account |
| 60 | authorized_key: |
| 61 | user={{ ansible_env['SUDO_USER'] }} |
| 62 | key="{{ sshkey.stdout }}" |
| 63 | |
| 64 | - name: Copy keypair to /tmp |
| 65 | shell: cp -f {{ ansible_user_dir }}/.ssh/{{ item }} /tmp; chmod +r /tmp/{{ item }} |
| 66 | with_items: |
| 67 | - id_rsa |
| 68 | - id_rsa.pub |
| 69 | |
| 70 | - name: Get ubuntu image for uvtool |
| 71 | shell: uvt-simplestreams-libvirt sync --source http://cloud-images.ubuntu.com/daily release={{ ansible_distribution_release }} arch=amd64 |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |