David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 1 | --- |
David K. Bainbridge | 8db2f30 | 2016-05-19 23:41:13 -0700 | [diff] [blame] | 2 | - name: Verify Manditory Variables |
| 3 | fail: msg="Variable '{{ item }}' is not defined" |
| 4 | when: item not in hostvars[inventory_hostname] |
| 5 | with_items: |
| 6 | - fabric_ip |
| 7 | tags: |
| 8 | - interface_config |
| 9 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 10 | - name: Applications |
| 11 | become: yes |
alshabib | 54cdbb2 | 2016-06-03 16:37:01 -0700 | [diff] [blame] | 12 | apt: name={{ item }} state=latest force=yes |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 13 | with_items: |
alshabib | 54cdbb2 | 2016-06-03 16:37:01 -0700 | [diff] [blame] | 14 | - build-essential |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame] | 15 | - git |
| 16 | - python-pip |
alshabib | 54cdbb2 | 2016-06-03 16:37:01 -0700 | [diff] [blame] | 17 | - ifenslave-2.6 |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame] | 18 | |
| 19 | - name: Ensure Docker Ansible Support |
| 20 | become: yes |
| 21 | pip: |
| 22 | name=docker-py |
| 23 | version=0.3.1 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 24 | |
| 25 | - name: Set Default Password |
| 26 | become: yes |
| 27 | user: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 28 | name={{ ansible_user }} |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 29 | password="$6$TjhJuOgh8xp.v$z/4GwFbn5koVmkD6Ex9wY7bgP7L3uP2ujZkZSs1HNdzQdz9YclbnZH9GvqMC/M1iwC0MceL05.13HoFz/bai0/" |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 30 | when: '"{{ ansible_user }}" == "ubuntu"' |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 31 | |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 32 | - name: Authorize SSH Key |
| 33 | become: yes |
| 34 | authorized_key: |
| 35 | key="{{ pub_ssh_key }}" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 36 | user={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 37 | state=present |
| 38 | |
| 39 | - name: Verify Private SSH Key |
| 40 | become: yes |
| 41 | stat: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 42 | path=/home/{{ ansible_user }}/.ssh/id_rsa |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 43 | register: private_key |
| 44 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 45 | - name: Ensure SSH Key |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 46 | become: yes |
| 47 | copy: |
| 48 | src=files/{{ item }} |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 49 | dest=/home/{{ ansible_user }}/.ssh/{{ item }} |
| 50 | owner={{ ansible_user }} |
| 51 | group={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 52 | mode=0600 |
| 53 | with_items: |
| 54 | - id_rsa |
| 55 | - id_rsa.pub |
David K. Bainbridge | 81bda33 | 2016-06-14 22:58:41 -0700 | [diff] [blame] | 56 | - config |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 57 | |
| 58 | - name: Ensure CORD SUDO |
| 59 | become: yes |
| 60 | copy: |
| 61 | src=files/99-cord-sudoers |
| 62 | dest=/etc/sudoers.d/99-cord-sudoers |
| 63 | owner=root |
| 64 | group=root |
| 65 | mode=0600 |
| 66 | |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 67 | - name: Verify Mellanox 40Gb NIC |
| 68 | shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true |
| 69 | register: mlx_nic_present |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 70 | changed_when: False |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 71 | |
| 72 | - name: Verify Intel 40Gb NIC |
| 73 | shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c "XL710 for 40GbE QSFP+" || true |
| 74 | register: intel_nic_present |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 75 | changed_when: False |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 76 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 77 | - name: Verify i40e Driver |
| 78 | command: modinfo --field=version i40e |
| 79 | register: i40e_version |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 80 | when: intel_nic_present.stdout == "1" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 81 | changed_when: False |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 82 | failed_when: False |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 83 | tags: |
| 84 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 85 | |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 86 | - name: Verify mlx4 Driver |
| 87 | command: modinfo --field=version mlx4_core |
| 88 | register: mlx4_version |
| 89 | when: mlx_nic_present.stdout == "1" |
| 90 | changed_when: False |
| 91 | failed_when: False |
| 92 | tags: |
| 93 | - interface_config |
| 94 | |
| 95 | - name: Update mlx4 Driver |
| 96 | include: tasks/mlx4_driver.yml |
| 97 | when: mlx_nic_present.stdout == "1" and mlx4_version.stdout != '3.1-1.0.4' |
| 98 | tags: |
| 99 | - interface_config |
| 100 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 101 | - name: Update i40e Driver |
| 102 | include: tasks/i40e_driver.yml |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 103 | when: intel_nic_present.stdout == "1" and i40e_version.stdout != '1.4.25' |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 104 | tags: |
| 105 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 106 | |
| 107 | - name: Consistent Interface Naming |
| 108 | become: yes |
David K. Bainbridge | 8db2f30 | 2016-05-19 23:41:13 -0700 | [diff] [blame] | 109 | script: files/rename_ifaces.sh {{ compute_node.interfaces.fabric }} {{ compute_node.addresses.fabric }} {{ compute_node.interfaces.external }} {{ compute_node.addresses.external }} {{ compute_node.interfaces.management }} |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 110 | register: ifaces_changed |
David K. Bainbridge | 8db2f30 | 2016-05-19 23:41:13 -0700 | [diff] [blame] | 111 | changed_when: ifaces_changed.stdout.find("true") != -1 |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 112 | tags: |
| 113 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 114 | |
alshabib | 54cdbb2 | 2016-06-03 16:37:01 -0700 | [diff] [blame] | 115 | - name: Load modules at boot |
| 116 | become: yes |
| 117 | lineinfile: |
| 118 | dest: /etc/modules |
| 119 | line: "{{ item }}" |
| 120 | with_items: |
| 121 | - lp |
| 122 | - loop |
| 123 | - rtc |
| 124 | - bonding |
| 125 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 126 | - name: Reboot Required |
| 127 | become: yes |
| 128 | command: /sbin/reboot |
David K. Bainbridge | 8db2f30 | 2016-05-19 23:41:13 -0700 | [diff] [blame] | 129 | async: 0 |
David K. Bainbridge | b5e232a | 2016-05-17 13:55:24 -0700 | [diff] [blame] | 130 | poll: 0 |
| 131 | ignore_errors: true |
David K. Bainbridge | df0f7e0 | 2016-05-20 09:18:28 -0700 | [diff] [blame] | 132 | when: ifaces_changed.stdout.find("true") != -1 |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 133 | tags: |
| 134 | - interface_config |
David K. Bainbridge | cd4caeb | 2016-05-23 14:58:12 -0700 | [diff] [blame] | 135 | - reboot |
David K. Bainbridge | b5e232a | 2016-05-17 13:55:24 -0700 | [diff] [blame] | 136 | |
| 137 | - name: Wait For Restart |
David K. Bainbridge | 8db2f30 | 2016-05-19 23:41:13 -0700 | [diff] [blame] | 138 | local_action: wait_for port=22 host={{ inventory_hostname }} search_regex=OpenSSH delay=30 timeout=600 connect_timeout=15 |
David K. Bainbridge | 22d5f3c | 2016-05-20 09:21:56 -0700 | [diff] [blame] | 139 | when: ifaces_changed.stdout.find("true") != -1 |
David K. Bainbridge | ed10154 | 2016-05-18 20:26:15 -0700 | [diff] [blame] | 140 | tags: |
| 141 | - interface_config |
David K. Bainbridge | cd4caeb | 2016-05-23 14:58:12 -0700 | [diff] [blame] | 142 | - reboot |