blob: 8b4badda11448356351ae25afa1f89266a51379b [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
David K. Bainbridge73ff2c22016-05-18 17:13:09 -070012 apt: name={{ item }} state=latest force=yes
David K. Bainbridge317e7d72016-05-11 08:31:44 -070013 with_items:
14 - build-essential
David K. Bainbridgee9f284d2016-05-18 14:13:43 -070015 - git
16 - python-pip
17
18- name: Ensure Docker Ansible Support
19 become: yes
20 pip:
21 name=docker-py
22 version=0.3.1
David K. Bainbridge317e7d72016-05-11 08:31:44 -070023
24- name: Set Default Password
25 become: yes
26 user:
David K. Bainbridgeb5415042016-05-13 17:06:10 -070027 name={{ ansible_user }}
David K. Bainbridge317e7d72016-05-11 08:31:44 -070028 password="$6$TjhJuOgh8xp.v$z/4GwFbn5koVmkD6Ex9wY7bgP7L3uP2ujZkZSs1HNdzQdz9YclbnZH9GvqMC/M1iwC0MceL05.13HoFz/bai0/"
David K. Bainbridge2a804222016-05-16 12:36:32 -070029 when: '"{{ ansible_user }}" == "ubuntu"'
David K. Bainbridge317e7d72016-05-11 08:31:44 -070030
David K. Bainbridge39d0c782016-05-11 13:27:57 -070031- name: Authorize SSH Key
32 become: yes
33 authorized_key:
34 key="{{ pub_ssh_key }}"
David K. Bainbridgeb5415042016-05-13 17:06:10 -070035 user={{ ansible_user }}
David K. Bainbridge39d0c782016-05-11 13:27:57 -070036 state=present
37
38- name: Verify Private SSH Key
39 become: yes
40 stat:
David K. Bainbridgeb5415042016-05-13 17:06:10 -070041 path=/home/{{ ansible_user }}/.ssh/id_rsa
David K. Bainbridge39d0c782016-05-11 13:27:57 -070042 register: private_key
43
David K. Bainbridgeb5415042016-05-13 17:06:10 -070044- name: Ensure SSH Key
David K. Bainbridge39d0c782016-05-11 13:27:57 -070045 become: yes
46 copy:
47 src=files/{{ item }}
David K. Bainbridgeb5415042016-05-13 17:06:10 -070048 dest=/home/{{ ansible_user }}/.ssh/{{ item }}
49 owner={{ ansible_user }}
50 group={{ ansible_user }}
David K. Bainbridge39d0c782016-05-11 13:27:57 -070051 mode=0600
52 with_items:
53 - id_rsa
54 - id_rsa.pub
55
56- name: Ensure CORD SUDO
57 become: yes
58 copy:
59 src=files/99-cord-sudoers
60 dest=/etc/sudoers.d/99-cord-sudoers
61 owner=root
62 group=root
63 mode=0600
64
alshabibe16ef4c2016-05-27 17:13:23 -070065- name: Verify Mellanox 40Gb NIC
66 shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true
67 register: mlx_nic_present
68
69- name: Verify Intel 40Gb NIC
70 shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c "XL710 for 40GbE QSFP+" || true
71 register: intel_nic_present
72
David K. Bainbridge317e7d72016-05-11 08:31:44 -070073- name: Verify i40e Driver
74 command: modinfo --field=version i40e
75 register: i40e_version
alshabibe16ef4c2016-05-27 17:13:23 -070076 when: intel_nic_present.stdout == "1"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070077 changed_when: False
David K. Bainbridgeb5415042016-05-13 17:06:10 -070078 failed_when: False
David K. Bainbridge4ec841c2016-05-11 22:10:15 -070079 tags:
80 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -070081
alshabibe16ef4c2016-05-27 17:13:23 -070082- name: Verify mlx4 Driver
83 command: modinfo --field=version mlx4_core
84 register: mlx4_version
85 when: mlx_nic_present.stdout == "1"
86 changed_when: False
87 failed_when: False
88 tags:
89 - interface_config
90
91- name: Update mlx4 Driver
92 include: tasks/mlx4_driver.yml
93 when: mlx_nic_present.stdout == "1" and mlx4_version.stdout != '3.1-1.0.4'
94 tags:
95 - interface_config
96
David K. Bainbridge317e7d72016-05-11 08:31:44 -070097- name: Update i40e Driver
98 include: tasks/i40e_driver.yml
alshabibe16ef4c2016-05-27 17:13:23 -070099 when: intel_nic_present.stdout == "1" and i40e_version.stdout != '1.4.25'
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700100 tags:
101 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700102
103- name: Consistent Interface Naming
104 become: yes
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700105 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 -0700106 register: ifaces_changed
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700107 changed_when: ifaces_changed.stdout.find("true") != -1
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700108 tags:
109 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700110
111- name: Reboot Required
112 become: yes
113 command: /sbin/reboot
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700114 async: 0
David K. Bainbridgeb5e232a2016-05-17 13:55:24 -0700115 poll: 0
116 ignore_errors: true
David K. Bainbridgedf0f7e02016-05-20 09:18:28 -0700117 when: ifaces_changed.stdout.find("true") != -1
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700118 tags:
119 - interface_config
David K. Bainbridgecd4caeb2016-05-23 14:58:12 -0700120 - reboot
David K. Bainbridgeb5e232a2016-05-17 13:55:24 -0700121
122- name: Wait For Restart
David K. Bainbridge8db2f302016-05-19 23:41:13 -0700123 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 -0700124 when: ifaces_changed.stdout.find("true") != -1
David K. Bainbridgeed101542016-05-18 20:26:15 -0700125 tags:
126 - interface_config
David K. Bainbridgecd4caeb2016-05-23 14:58:12 -0700127 - reboot