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 }} |
Zack Williams | 7ec058b | 2016-05-02 10:10:39 -0700 | [diff] [blame] | 7 | update_cache=yes |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 8 | 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. Bainbridge | 77a516a | 2016-10-27 10:57:57 -0700 | [diff] [blame] | 16 | - "{{ juju_apt_repo | default('ppa:juju/stable') }}" |
Sapan Bhatia | 96426ec | 2017-04-13 19:41:04 -0700 | [diff] [blame] | 17 | # - "{{ ansible_apt_repo | default('ppa:ansible/ansible') }}" |
Andy Bavier | 8cbc1f8 | 2017-02-24 16:35:39 -0500 | [diff] [blame] | 18 | register: result |
| 19 | until: result | success |
| 20 | retries: 3 |
| 21 | delay: 10 |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 22 | |
| 23 | - name: Install packages |
| 24 | apt: |
| 25 | name={{ item }} |
Zack Williams | b6bf2ec | 2016-08-10 15:38:43 -0700 | [diff] [blame] | 26 | state=present |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 27 | update_cache=yes |
| 28 | with_items: |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 29 | - uvtool |
| 30 | - git |
| 31 | - bzr |
| 32 | - juju-core |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 33 | - python-pip |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 34 | - python-novaclient |
| 35 | - python-neutronclient |
| 36 | - python-keystoneclient |
| 37 | - python-glanceclient |
Zack Williams | 2b94629 | 2016-08-22 15:32:29 -0700 | [diff] [blame] | 38 | - python-lxml |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 39 | - virt-top |
Sapan Bhatia | 96426ec | 2017-04-13 19:41:04 -0700 | [diff] [blame] | 40 | - libssl-dev |
| 41 | - python-dev |
| 42 | - sshpass |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 43 | |
Andy Bavier | 4464e67 | 2017-10-12 17:15:28 -0700 | [diff] [blame] | 44 | - name: Install Cryptography package via pip |
| 45 | pip: name=cryptography version=1.9 |
| 46 | |
Sapan Bhatia | 96426ec | 2017-04-13 19:41:04 -0700 | [diff] [blame] | 47 | - name: Install Ansible via pip |
| 48 | pip: name=ansible version=2.2.2.0 |
| 49 | # - name: Make sure Ansible is newest version |
| 50 | # apt: |
| 51 | # name: "ansible" |
| 52 | # state: latest |
| 53 | # update_cache: yes |
| 54 | # cache_valid_time: 3600 |
| 55 | # tags: |
| 56 | # - 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 Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 57 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 58 | - name: Install Python packages |
| 59 | pip: |
| 60 | name={{ item}} |
| 61 | state=present |
| 62 | with_items: |
| 63 | - urllib3 |
| 64 | - pyopenssl |
| 65 | - ndg-httpsclient |
| 66 | - pyasn1 |
| 67 | |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 68 | - name: Prep user account by adding to libvirtd group and generating SSH key |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 69 | user: |
Zack Williams | 9cdf862 | 2016-02-26 22:42:50 -0700 | [diff] [blame] | 70 | name={{ ansible_user_id }} |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 71 | generate_ssh_key=yes |
| 72 | groups="libvirtd" append=yes |
| 73 | |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 74 | - name: Register public key in variable |
Zack Williams | 9cdf862 | 2016-02-26 22:42:50 -0700 | [diff] [blame] | 75 | shell: cat {{ ansible_user_dir }}/.ssh/id_rsa.pub |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 76 | register: sshkey |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 77 | tags: |
| 78 | - skip_ansible_lint # FIXME: this should be done a different way |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 79 | |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 80 | - name: Add public key to this user account |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 81 | authorized_key: |
Zack Williams | 9cdf862 | 2016-02-26 22:42:50 -0700 | [diff] [blame] | 82 | user={{ ansible_user_id }} |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 83 | key="{{ sshkey.stdout }}" |
| 84 | |
Zack Williams | 2cffa0f | 2016-05-20 12:18:47 -0700 | [diff] [blame] | 85 | - name: Disable host key checking in ~/.ssh/config |
| 86 | lineinfile: |
| 87 | dest={{ ansible_user_dir }}/.ssh/config |
| 88 | line="StrictHostKeyChecking no" |
| 89 | create=yes |
| 90 | owner={{ ansible_user_id }} mode=0600 |
| 91 | |
| 92 | - name: Disable host key checking in ~/.ansible.cfg |
| 93 | copy: |
| 94 | src=ansible.cfg |
| 95 | dest={{ ansible_user_dir }}/.ansible.cfg |
| 96 | owner={{ ansible_user_id }} mode=0644 |