blob: 31c25ba9983577b1e963a4a0e0790a427b93b205 [file] [log] [blame]
David K. Bainbridge317e7d72016-05-11 08:31:44 -07001---
David K. Bainbridge8db2f302016-05-19 23:41:13 -07002- 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. Bainbridge317e7d72016-05-11 08:31:44 -070010- name: Applications
11 become: yes
alshabib54cdbb22016-06-03 16:37:01 -070012 apt: name={{ item }} state=latest force=yes
David K. Bainbridge317e7d72016-05-11 08:31:44 -070013 with_items:
alshabib54cdbb22016-06-03 16:37:01 -070014 - build-essential
David K. Bainbridgee9f284d2016-05-18 14:13:43 -070015 - git
16 - python-pip
alshabib54cdbb22016-06-03 16:37:01 -070017 - ifenslave-2.6
David K. Bainbridgee9f284d2016-05-18 14:13:43 -070018
19- name: Ensure Docker Ansible Support
20 become: yes
21 pip:
22 name=docker-py
23 version=0.3.1
David K. Bainbridge317e7d72016-05-11 08:31:44 -070024
25- name: Set Default Password
26 become: yes
27 user:
David K. Bainbridgeb5415042016-05-13 17:06:10 -070028 name={{ ansible_user }}
David K. Bainbridge317e7d72016-05-11 08:31:44 -070029 password="$6$TjhJuOgh8xp.v$z/4GwFbn5koVmkD6Ex9wY7bgP7L3uP2ujZkZSs1HNdzQdz9YclbnZH9GvqMC/M1iwC0MceL05.13HoFz/bai0/"
David K. Bainbridge2a804222016-05-16 12:36:32 -070030 when: '"{{ ansible_user }}" == "ubuntu"'
David K. Bainbridge317e7d72016-05-11 08:31:44 -070031
David K. Bainbridge39d0c782016-05-11 13:27:57 -070032- name: Authorize SSH Key
33 become: yes
34 authorized_key:
35 key="{{ pub_ssh_key }}"
David K. Bainbridgeb5415042016-05-13 17:06:10 -070036 user={{ ansible_user }}
David K. Bainbridge39d0c782016-05-11 13:27:57 -070037 state=present
38
39- name: Verify Private SSH Key
40 become: yes
41 stat:
David K. Bainbridgeb5415042016-05-13 17:06:10 -070042 path=/home/{{ ansible_user }}/.ssh/id_rsa
David K. Bainbridge39d0c782016-05-11 13:27:57 -070043 register: private_key
44
David K. Bainbridgeb5415042016-05-13 17:06:10 -070045- name: Ensure SSH Key
David K. Bainbridge39d0c782016-05-11 13:27:57 -070046 become: yes
47 copy:
48 src=files/{{ item }}
David K. Bainbridgeb5415042016-05-13 17:06:10 -070049 dest=/home/{{ ansible_user }}/.ssh/{{ item }}
50 owner={{ ansible_user }}
51 group={{ ansible_user }}
David K. Bainbridge39d0c782016-05-11 13:27:57 -070052 mode=0600
53 with_items:
54 - id_rsa
55 - id_rsa.pub
56
57- name: Ensure CORD SUDO
58 become: yes
59 copy:
60 src=files/99-cord-sudoers
61 dest=/etc/sudoers.d/99-cord-sudoers
62 owner=root
63 group=root
64 mode=0600
65
alshabibe16ef4c2016-05-27 17:13:23 -070066- name: Verify Mellanox 40Gb NIC
67 shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true
68 register: mlx_nic_present
David K. Bainbridge0820cab2016-06-02 17:43:32 -070069 changed_when: False
alshabibe16ef4c2016-05-27 17:13:23 -070070
71- name: Verify Intel 40Gb NIC
72 shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c "XL710 for 40GbE QSFP+" || true
73 register: intel_nic_present
David K. Bainbridge0820cab2016-06-02 17:43:32 -070074 changed_when: False
alshabibe16ef4c2016-05-27 17:13:23 -070075
David K. Bainbridge317e7d72016-05-11 08:31:44 -070076- name: Verify i40e Driver
77 command: modinfo --field=version i40e
78 register: i40e_version
alshabibe16ef4c2016-05-27 17:13:23 -070079 when: intel_nic_present.stdout == "1"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070080 changed_when: False
David K. Bainbridgeb5415042016-05-13 17:06:10 -070081 failed_when: False
David K. Bainbridge4ec841c2016-05-11 22:10:15 -070082 tags:
83 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -070084
alshabibe16ef4c2016-05-27 17:13:23 -070085- name: Verify mlx4 Driver
86 command: modinfo --field=version mlx4_core
87 register: mlx4_version
88 when: mlx_nic_present.stdout == "1"
89 changed_when: False
90 failed_when: False
91 tags:
92 - interface_config
93
94- name: Update mlx4 Driver
95 include: tasks/mlx4_driver.yml
96 when: mlx_nic_present.stdout == "1" and mlx4_version.stdout != '3.1-1.0.4'
97 tags:
98 - interface_config
99
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700100- name: Update i40e Driver
101 include: tasks/i40e_driver.yml
alshabibe16ef4c2016-05-27 17:13:23 -0700102 when: intel_nic_present.stdout == "1" and i40e_version.stdout != '1.4.25'
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700103 tags:
104 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700105
106- name: Consistent Interface Naming
107 become: yes
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700108 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. Bainbridge317e7d72016-05-11 08:31:44 -0700109 register: ifaces_changed
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700110 changed_when: ifaces_changed.stdout.find("true") != -1
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700111 tags:
112 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700113
alshabib54cdbb22016-06-03 16:37:01 -0700114- name: Load modules at boot
115 become: yes
116 lineinfile:
117 dest: /etc/modules
118 line: "{{ item }}"
119 with_items:
120 - lp
121 - loop
122 - rtc
123 - bonding
124
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700125- name: Reboot Required
126 become: yes
127 command: /sbin/reboot
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700128 async: 0
David K. Bainbridgeb5e232a2016-05-17 13:55:24 -0700129 poll: 0
130 ignore_errors: true
David K. Bainbridgedf0f7e02016-05-20 09:18:28 -0700131 when: ifaces_changed.stdout.find("true") != -1
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700132 tags:
133 - interface_config
David K. Bainbridgecd4caeb2016-05-23 14:58:12 -0700134 - reboot
David K. Bainbridgeb5e232a2016-05-17 13:55:24 -0700135
136- name: Wait For Restart
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700137 local_action: wait_for port=22 host={{ inventory_hostname }} search_regex=OpenSSH delay=30 timeout=600 connect_timeout=15
David K. Bainbridge22d5f3c2016-05-20 09:21:56 -0700138 when: ifaces_changed.stdout.find("true") != -1
David K. Bainbridgeed101542016-05-18 20:26:15 -0700139 tags:
140 - interface_config
David K. Bainbridgecd4caeb2016-05-23 14:58:12 -0700141 - reboot