David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 1 | --- |
| 2 | - name: Applications |
| 3 | become: yes |
| 4 | apt: name={{ item }} state=present |
| 5 | with_items: |
| 6 | - build-essential |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame^] | 7 | - git |
| 8 | - python-pip |
| 9 | |
| 10 | - name: Ensure Docker Ansible Support |
| 11 | become: yes |
| 12 | pip: |
| 13 | name=docker-py |
| 14 | version=0.3.1 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 15 | |
| 16 | - name: Set Default Password |
| 17 | become: yes |
| 18 | user: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 19 | name={{ ansible_user }} |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 20 | password="$6$TjhJuOgh8xp.v$z/4GwFbn5koVmkD6Ex9wY7bgP7L3uP2ujZkZSs1HNdzQdz9YclbnZH9GvqMC/M1iwC0MceL05.13HoFz/bai0/" |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 21 | when: '"{{ ansible_user }}" == "ubuntu"' |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 22 | |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 23 | - name: Authorize SSH Key |
| 24 | become: yes |
| 25 | authorized_key: |
| 26 | key="{{ pub_ssh_key }}" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 27 | user={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 28 | state=present |
| 29 | |
| 30 | - name: Verify Private SSH Key |
| 31 | become: yes |
| 32 | stat: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 33 | path=/home/{{ ansible_user }}/.ssh/id_rsa |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 34 | register: private_key |
| 35 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 36 | - name: Ensure SSH Key |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 37 | become: yes |
| 38 | copy: |
| 39 | src=files/{{ item }} |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 40 | dest=/home/{{ ansible_user }}/.ssh/{{ item }} |
| 41 | owner={{ ansible_user }} |
| 42 | group={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 43 | mode=0600 |
| 44 | with_items: |
| 45 | - id_rsa |
| 46 | - id_rsa.pub |
| 47 | |
| 48 | - name: Ensure CORD SUDO |
| 49 | become: yes |
| 50 | copy: |
| 51 | src=files/99-cord-sudoers |
| 52 | dest=/etc/sudoers.d/99-cord-sudoers |
| 53 | owner=root |
| 54 | group=root |
| 55 | mode=0600 |
| 56 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 57 | - name: Verify i40e Driver |
| 58 | command: modinfo --field=version i40e |
| 59 | register: i40e_version |
| 60 | changed_when: False |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 61 | failed_when: False |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 62 | tags: |
| 63 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 64 | |
| 65 | - name: Update i40e Driver |
| 66 | include: tasks/i40e_driver.yml |
| 67 | when: i40e_version.stdout != '1.4.25' |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 68 | tags: |
| 69 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 70 | |
| 71 | - name: Consistent Interface Naming |
| 72 | become: yes |
| 73 | script: files/rename_ifaces.sh {{ fabric_ip }} |
| 74 | register: ifaces_changed |
| 75 | changed_when: ifaces_changed.stdout != "false" |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 76 | tags: |
| 77 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 78 | |
| 79 | - name: Reboot Required |
| 80 | become: yes |
| 81 | command: /sbin/reboot |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame^] | 82 | async: 1 |
David K. Bainbridge | b5e232a | 2016-05-17 13:55:24 -0700 | [diff] [blame] | 83 | poll: 0 |
| 84 | ignore_errors: true |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 85 | when: ifaces_changed.stdout != "false" |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 86 | tags: |
| 87 | - interface_config |
David K. Bainbridge | b5e232a | 2016-05-17 13:55:24 -0700 | [diff] [blame] | 88 | |
| 89 | - name: Wait For Restart |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame^] | 90 | local_action: wait_for host={{ ansible_host }} state=started port=22 delay=30 search_regex=OpenSSH timeout=600 |