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 | d4a63e0 | 2016-09-14 12:28:00 -0700 | [diff] [blame] | 10 | - 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. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 18 | - name: Applications |
| 19 | become: yes |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 20 | apt: name={{ item }} state=present force=yes |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 21 | with_items: |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 22 | - 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 Bavier | d1ff927 | 2016-09-08 17:11:54 -0400 | [diff] [blame] | 30 | - jq=1.3* |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame] | 31 | |
David K. Bainbridge | 589a08f | 2016-06-15 18:14:18 -0700 | [diff] [blame] | 32 | - 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. Bainbridge | fac79ca | 2016-07-28 10:00:44 -0700 | [diff] [blame] | 40 | - 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. Bainbridge | 589a08f | 2016-06-15 18:14:18 -0700 | [diff] [blame] | 48 | - name: Docker Restart |
| 49 | become: yes |
| 50 | service: |
| 51 | name=docker |
| 52 | state=restarted |
David K. Bainbridge | fac79ca | 2016-07-28 10:00:44 -0700 | [diff] [blame] | 53 | when: docker_config.changed or docker_config_mirror.changed |
David K. Bainbridge | 589a08f | 2016-06-15 18:14:18 -0700 | [diff] [blame] | 54 | |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame] | 55 | - name: Ensure Docker Ansible Support |
| 56 | become: yes |
| 57 | pip: |
| 58 | name=docker-py |
David K. Bainbridge | 2dd2ddd | 2016-09-06 08:22:52 -0700 | [diff] [blame] | 59 | version=1.9 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 60 | |
| 61 | - name: Set Default Password |
| 62 | become: yes |
| 63 | user: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 64 | name={{ ansible_user }} |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 65 | password="$6$TjhJuOgh8xp.v$z/4GwFbn5koVmkD6Ex9wY7bgP7L3uP2ujZkZSs1HNdzQdz9YclbnZH9GvqMC/M1iwC0MceL05.13HoFz/bai0/" |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 66 | when: '"{{ ansible_user }}" == "ubuntu"' |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 67 | |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 68 | - name: Authorize SSH Key |
| 69 | become: yes |
| 70 | authorized_key: |
| 71 | key="{{ pub_ssh_key }}" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 72 | user={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 73 | state=present |
| 74 | |
| 75 | - name: Verify Private SSH Key |
| 76 | become: yes |
| 77 | stat: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 78 | path=/home/{{ ansible_user }}/.ssh/id_rsa |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 79 | register: private_key |
| 80 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 81 | - name: Ensure SSH Key |
Andy Bavier | ceab230 | 2016-07-07 09:04:07 -0400 | [diff] [blame] | 82 | become: no |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 83 | copy: |
| 84 | src=files/{{ item }} |
Andy Bavier | ceab230 | 2016-07-07 09:04:07 -0400 | [diff] [blame] | 85 | dest={{ ansible_env['PWD'] }}/.ssh/{{ item }} |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 86 | owner={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 87 | mode=0600 |
| 88 | with_items: |
| 89 | - id_rsa |
| 90 | - id_rsa.pub |
David K. Bainbridge | 81bda33 | 2016-06-14 22:58:41 -0700 | [diff] [blame] | 91 | - config |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 92 | |
| 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. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 102 | - 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. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 118 | - remove-maas-components |
David K. Bainbridge | 1e4142d | 2016-08-04 10:01:58 -0700 | [diff] [blame] | 119 | - post-fabric-config |
David K. Bainbridge | e80fd39 | 2016-08-19 15:46:19 -0700 | [diff] [blame] | 120 | - pull-latest-docker-images |
David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 121 | |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 122 | - 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. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 125 | changed_when: False |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 126 | |
| 127 | - name: Verify Intel 40Gb NIC |
breezestars | d625aba | 2016-11-21 06:44:38 +0800 | [diff] [blame] | 128 | shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c -E "XL710 for 40GbE QSFP+|X710 for 10GbE SFP+" || true |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 129 | register: intel_nic_present |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 130 | changed_when: False |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 131 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 132 | - name: Verify i40e Driver |
| 133 | command: modinfo --field=version i40e |
| 134 | register: i40e_version |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 135 | when: intel_nic_present.stdout != "0" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 136 | changed_when: False |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 137 | failed_when: False |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 138 | tags: |
| 139 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 140 | |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 141 | - name: Verify mlx4 Driver |
| 142 | command: modinfo --field=version mlx4_core |
| 143 | register: mlx4_version |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 144 | when: mlx_nic_present.stdout != "0" |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 145 | changed_when: False |
| 146 | failed_when: False |
| 147 | tags: |
| 148 | - interface_config |
| 149 | |
| 150 | - name: Update mlx4 Driver |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 151 | include: mlx4_driver.yml |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 152 | when: mlx_nic_present.stdout != "0" and mlx4_version.stdout != '3.1-1.0.4' |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 153 | tags: |
| 154 | - interface_config |
| 155 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 156 | - name: Update i40e Driver |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 157 | include: i40e_driver.yml |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 158 | when: intel_nic_present.stdout != "0" and i40e_version.stdout != '1.4.25' |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 159 | tags: |
| 160 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 161 | |
alshabib | 54cdbb2 | 2016-06-03 16:37:01 -0700 | [diff] [blame] | 162 | - 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. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 173 | - name: Ensure Network Configuration |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 174 | become: yes |
David K. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 175 | include: networking.yml |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 176 | tags: |
| 177 | - interface_config |