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 |
| 8 | cache_valid_time=3600 |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 9 | with_items: |
| 10 | - python-pycurl |
| 11 | - software-properties-common |
| 12 | |
| 13 | - name: Add Ansible/Juju repositories |
| 14 | apt_repository: |
| 15 | repo={{ item }} |
| 16 | with_items: |
| 17 | - "ppa:juju/stable" |
| 18 | - "ppa:ansible/ansible" |
| 19 | |
| 20 | - name: Install packages |
| 21 | apt: |
| 22 | name={{ item }} |
Zack Williams | b6bf2ec | 2016-08-10 15:38:43 -0700 | [diff] [blame] | 23 | state=present |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 24 | update_cache=yes |
Zack Williams | 1320e1f | 2016-05-02 09:54:08 -0700 | [diff] [blame] | 25 | cache_valid_time=3600 |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 26 | with_items: |
| 27 | - ansible |
| 28 | - uvtool |
| 29 | - git |
| 30 | - bzr |
| 31 | - juju-core |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 32 | - python-pip |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 33 | - python-novaclient |
| 34 | - python-neutronclient |
| 35 | - python-keystoneclient |
| 36 | - python-glanceclient |
Zack Williams | 2b94629 | 2016-08-22 15:32:29 -0700 | [diff] [blame] | 37 | - python-lxml |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 38 | - virt-top |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 39 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 40 | - name: Install Python packages |
| 41 | pip: |
| 42 | name={{ item}} |
| 43 | state=present |
| 44 | with_items: |
| 45 | - urllib3 |
| 46 | - pyopenssl |
| 47 | - ndg-httpsclient |
| 48 | - pyasn1 |
| 49 | |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 50 | - 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] | 51 | user: |
Zack Williams | 9cdf862 | 2016-02-26 22:42:50 -0700 | [diff] [blame] | 52 | name={{ ansible_user_id }} |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 53 | generate_ssh_key=yes |
| 54 | groups="libvirtd" append=yes |
| 55 | |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 56 | - name: Register public key in variable |
Zack Williams | 9cdf862 | 2016-02-26 22:42:50 -0700 | [diff] [blame] | 57 | shell: cat {{ ansible_user_dir }}/.ssh/id_rsa.pub |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 58 | register: sshkey |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 59 | tags: |
| 60 | - skip_ansible_lint # FIXME: this should be done a different way |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 61 | |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 62 | - name: Add public key to this user account |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 63 | authorized_key: |
Zack Williams | 9cdf862 | 2016-02-26 22:42:50 -0700 | [diff] [blame] | 64 | user={{ ansible_user_id }} |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 65 | key="{{ sshkey.stdout }}" |
| 66 | |
Zack Williams | 2cffa0f | 2016-05-20 12:18:47 -0700 | [diff] [blame] | 67 | - name: Disable host key checking in ~/.ssh/config |
| 68 | lineinfile: |
| 69 | dest={{ ansible_user_dir }}/.ssh/config |
| 70 | line="StrictHostKeyChecking no" |
| 71 | create=yes |
| 72 | owner={{ ansible_user_id }} mode=0600 |
| 73 | |
| 74 | - name: Disable host key checking in ~/.ansible.cfg |
| 75 | copy: |
| 76 | src=ansible.cfg |
| 77 | dest={{ ansible_user_dir }}/.ansible.cfg |
| 78 | owner={{ ansible_user_id }} mode=0644 |
| 79 | |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 80 | - name: Copy node key |
| 81 | when: not on_maas |
Andy Bavier | 6274d6a | 2016-08-12 18:12:01 -0400 | [diff] [blame] | 82 | copy: |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 83 | src={{ ansible_user_dir }}/.ssh/id_rsa |
Andy Bavier | 6274d6a | 2016-08-12 18:12:01 -0400 | [diff] [blame] | 84 | dest={{ ansible_user_dir }}/node_key |
| 85 | owner={{ ansible_user }} |
| 86 | mode=0600 |
| 87 | remote_src=True |
Andy Bavier | 6274d6a | 2016-08-12 18:12:01 -0400 | [diff] [blame] | 88 | |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 89 | - name: Copy node key (MaaS) |
| 90 | when: on_maas |
Andy Bavier | 6274d6a | 2016-08-12 18:12:01 -0400 | [diff] [blame] | 91 | copy: |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 92 | src={{ maas_node_key }} |
Andy Bavier | 6274d6a | 2016-08-12 18:12:01 -0400 | [diff] [blame] | 93 | dest={{ ansible_user_dir }}/node_key |
| 94 | owner={{ ansible_user }} |
| 95 | mode=0600 |
| 96 | remote_src=True |
Zack Williams | 6f5a6e7 | 2016-08-10 17:45:27 -0700 | [diff] [blame] | 97 | |