blob: 8671725270bca6256fa7768b40c2266f63891fe1 [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. Bainbridged4a63e02016-09-14 12:28:00 -070010- name: Verify Network Bits on Network Specifications
11 fail: msg="Network specification '{{ item }}' must include network bits"
12 when: "item != 'dhcp' and item != 'manual' and item | match('^([0-9]{1,3}.){3}[0-9]{1,3}$')"
13 with_items:
14 - "{{ compute_node.addresses.fabric }}"
15 - "{{ compute_node.addresses.management }}"
16 - "{{ compute_node.addresses.external }}"
17
David K. Bainbridge317e7d72016-05-11 08:31:44 -070018- name: Applications
19 become: yes
David K. Bainbridge17248c02016-08-29 17:04:34 -070020 apt: name={{ item }} state=present force=yes
David K. Bainbridge317e7d72016-05-11 08:31:44 -070021 with_items:
David K. Bainbridge17248c02016-08-29 17:04:34 -070022 - build-essential=11.6*
23 - git=1:1.9.*
24 - python-pip=1.5.4*
25 - ifenslave-2.6=2.4*
26 - bridge-utils=1.5-*
27 - ethtool=1:3.13*
28 - minicom=2.7*
29 - curl=7.35.*
Andy Bavierd1ff9272016-09-08 17:11:54 -040030 - jq=1.3*
David K. Bainbridgee9f284d2016-05-18 14:13:43 -070031
David K. Bainbridge589a08f2016-06-15 18:14:18 -070032- name: Ensure Docker Insecure Repository
33 become: yes
34 lineinfile:
35 dest: /etc/default/docker
36 line: 'DOCKER_OPTS="$DOCKER_OPTS --insecure-registry docker-registry:5000"'
37 insertafter: '^DOCKER_OPTS'
38 register: docker_config
39
David K. Bainbridgefac79ca2016-07-28 10:00:44 -070040- name: Ensure Docker Registry Mirror
41 become: yes
42 lineinfile:
43 dest: /etc/default/docker
44 line: 'DOCKER_OPTS="$DOCKER_OPTS --registry-mirror=http://docker-registry:5001"'
45 insertafter: '^DOCKER_OPTS'
46 register: docker_config_mirror
47
David K. Bainbridge589a08f2016-06-15 18:14:18 -070048- name: Docker Restart
49 become: yes
50 service:
51 name=docker
52 state=restarted
David K. Bainbridgefac79ca2016-07-28 10:00:44 -070053 when: docker_config.changed or docker_config_mirror.changed
David K. Bainbridge589a08f2016-06-15 18:14:18 -070054
David K. Bainbridgee9f284d2016-05-18 14:13:43 -070055- name: Ensure Docker Ansible Support
56 become: yes
57 pip:
58 name=docker-py
David K. Bainbridge2dd2ddd2016-09-06 08:22:52 -070059 version=1.9
David K. Bainbridge317e7d72016-05-11 08:31:44 -070060
61- name: Set Default Password
62 become: yes
63 user:
David K. Bainbridgeb5415042016-05-13 17:06:10 -070064 name={{ ansible_user }}
David K. Bainbridge317e7d72016-05-11 08:31:44 -070065 password="$6$TjhJuOgh8xp.v$z/4GwFbn5koVmkD6Ex9wY7bgP7L3uP2ujZkZSs1HNdzQdz9YclbnZH9GvqMC/M1iwC0MceL05.13HoFz/bai0/"
David K. Bainbridge2a804222016-05-16 12:36:32 -070066 when: '"{{ ansible_user }}" == "ubuntu"'
David K. Bainbridge317e7d72016-05-11 08:31:44 -070067
David K. Bainbridge39d0c782016-05-11 13:27:57 -070068- name: Authorize SSH Key
69 become: yes
70 authorized_key:
71 key="{{ pub_ssh_key }}"
David K. Bainbridgeb5415042016-05-13 17:06:10 -070072 user={{ ansible_user }}
David K. Bainbridge39d0c782016-05-11 13:27:57 -070073 state=present
74
75- name: Verify Private SSH Key
76 become: yes
77 stat:
David K. Bainbridgeb5415042016-05-13 17:06:10 -070078 path=/home/{{ ansible_user }}/.ssh/id_rsa
David K. Bainbridge39d0c782016-05-11 13:27:57 -070079 register: private_key
80
David K. Bainbridgeb5415042016-05-13 17:06:10 -070081- name: Ensure SSH Key
Andy Bavierceab2302016-07-07 09:04:07 -040082 become: no
David K. Bainbridge39d0c782016-05-11 13:27:57 -070083 copy:
84 src=files/{{ item }}
Andy Bavierceab2302016-07-07 09:04:07 -040085 dest={{ ansible_env['PWD'] }}/.ssh/{{ item }}
David K. Bainbridgeb5415042016-05-13 17:06:10 -070086 owner={{ ansible_user }}
David K. Bainbridge39d0c782016-05-11 13:27:57 -070087 mode=0600
88 with_items:
89 - id_rsa
90 - id_rsa.pub
David K. Bainbridge81bda332016-06-14 22:58:41 -070091 - config
David K. Bainbridge39d0c782016-05-11 13:27:57 -070092
93- name: Ensure CORD SUDO
94 become: yes
95 copy:
96 src=files/99-cord-sudoers
97 dest=/etc/sudoers.d/99-cord-sudoers
98 owner=root
99 group=root
100 mode=0600
101
David K. Bainbridgef3071012016-08-04 09:29:55 -0700102- name: Ensure Utility Scripts
103 become: yes
104 copy:
105 src=files/{{ item }}
106 dest=/usr/local/bin/{{ item }}
107 owner=root
108 group=root
109 mode=0755
110 with_items:
111 - delete-fabric-config
112 - delete-node-prov-state
113 - docker-ip
114 - fabric-pingall
115 - get-fabric-config
116 - get-node-prov-state
117 - remove-xos-components
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700118 - remove-maas-components
David K. Bainbridge1e4142d2016-08-04 10:01:58 -0700119 - post-fabric-config
David K. Bainbridgee80fd392016-08-19 15:46:19 -0700120 - pull-latest-docker-images
David K. Bainbridgef3071012016-08-04 09:29:55 -0700121
alshabibe16ef4c2016-05-27 17:13:23 -0700122- name: Verify Mellanox 40Gb NIC
123 shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true
124 register: mlx_nic_present
David K. Bainbridge0820cab2016-06-02 17:43:32 -0700125 changed_when: False
alshabibe16ef4c2016-05-27 17:13:23 -0700126
127- name: Verify Intel 40Gb NIC
128 shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c "XL710 for 40GbE QSFP+" || true
129 register: intel_nic_present
David K. Bainbridge0820cab2016-06-02 17:43:32 -0700130 changed_when: False
alshabibe16ef4c2016-05-27 17:13:23 -0700131
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700132- name: Verify i40e Driver
133 command: modinfo --field=version i40e
134 register: i40e_version
David K. Bainbridge10a8b982016-06-28 10:43:44 -0700135 when: intel_nic_present.stdout != "0"
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700136 changed_when: False
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700137 failed_when: False
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700138 tags:
139 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700140
alshabibe16ef4c2016-05-27 17:13:23 -0700141- name: Verify mlx4 Driver
142 command: modinfo --field=version mlx4_core
143 register: mlx4_version
David K. Bainbridge10a8b982016-06-28 10:43:44 -0700144 when: mlx_nic_present.stdout != "0"
alshabibe16ef4c2016-05-27 17:13:23 -0700145 changed_when: False
146 failed_when: False
147 tags:
148 - interface_config
149
150- name: Update mlx4 Driver
David K. Bainbridge17248c02016-08-29 17:04:34 -0700151 include: mlx4_driver.yml
David K. Bainbridge10a8b982016-06-28 10:43:44 -0700152 when: mlx_nic_present.stdout != "0" and mlx4_version.stdout != '3.1-1.0.4'
alshabibe16ef4c2016-05-27 17:13:23 -0700153 tags:
154 - interface_config
155
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700156- name: Update i40e Driver
David K. Bainbridge17248c02016-08-29 17:04:34 -0700157 include: i40e_driver.yml
David K. Bainbridge10a8b982016-06-28 10:43:44 -0700158 when: intel_nic_present.stdout != "0" and i40e_version.stdout != '1.4.25'
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700159 tags:
160 - interface_config
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700161
alshabib54cdbb22016-06-03 16:37:01 -0700162- name: Load modules at boot
163 become: yes
164 lineinfile:
165 dest: /etc/modules
166 line: "{{ item }}"
167 with_items:
168 - lp
169 - loop
170 - rtc
171 - bonding
172
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700173- name: Ensure Network Configuration
David K. Bainbridge317e7d72016-05-11 08:31:44 -0700174 become: yes
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700175 include: networking.yml
David K. Bainbridge4ec841c2016-05-11 22:10:15 -0700176 tags:
177 - interface_config