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