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 |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 12 | apt: name={{ item }} state=present force=yes |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 13 | with_items: |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 14 | - build-essential=11.6* |
| 15 | - git=1:1.9.* |
| 16 | - python-pip=1.5.4* |
| 17 | - ifenslave-2.6=2.4* |
| 18 | - bridge-utils=1.5-* |
| 19 | - ethtool=1:3.13* |
| 20 | - minicom=2.7* |
| 21 | - curl=7.35.* |
Andy Bavier | d1ff927 | 2016-09-08 17:11:54 -0400 | [diff] [blame] | 22 | - jq=1.3* |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame] | 23 | |
David K. Bainbridge | 589a08f | 2016-06-15 18:14:18 -0700 | [diff] [blame] | 24 | - name: Ensure Docker Insecure Repository |
| 25 | become: yes |
| 26 | lineinfile: |
| 27 | dest: /etc/default/docker |
| 28 | line: 'DOCKER_OPTS="$DOCKER_OPTS --insecure-registry docker-registry:5000"' |
| 29 | insertafter: '^DOCKER_OPTS' |
| 30 | register: docker_config |
| 31 | |
David K. Bainbridge | fac79ca | 2016-07-28 10:00:44 -0700 | [diff] [blame] | 32 | - name: Ensure Docker Registry Mirror |
| 33 | become: yes |
| 34 | lineinfile: |
| 35 | dest: /etc/default/docker |
| 36 | line: 'DOCKER_OPTS="$DOCKER_OPTS --registry-mirror=http://docker-registry:5001"' |
| 37 | insertafter: '^DOCKER_OPTS' |
| 38 | register: docker_config_mirror |
| 39 | |
David K. Bainbridge | 589a08f | 2016-06-15 18:14:18 -0700 | [diff] [blame] | 40 | - name: Docker Restart |
| 41 | become: yes |
| 42 | service: |
| 43 | name=docker |
| 44 | state=restarted |
David K. Bainbridge | fac79ca | 2016-07-28 10:00:44 -0700 | [diff] [blame] | 45 | when: docker_config.changed or docker_config_mirror.changed |
David K. Bainbridge | 589a08f | 2016-06-15 18:14:18 -0700 | [diff] [blame] | 46 | |
David K. Bainbridge | e9f284d | 2016-05-18 14:13:43 -0700 | [diff] [blame] | 47 | - name: Ensure Docker Ansible Support |
| 48 | become: yes |
| 49 | pip: |
| 50 | name=docker-py |
David K. Bainbridge | 2dd2ddd | 2016-09-06 08:22:52 -0700 | [diff] [blame] | 51 | version=1.9 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 52 | |
| 53 | - name: Set Default Password |
| 54 | become: yes |
| 55 | user: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 56 | name={{ ansible_user }} |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 57 | password="$6$TjhJuOgh8xp.v$z/4GwFbn5koVmkD6Ex9wY7bgP7L3uP2ujZkZSs1HNdzQdz9YclbnZH9GvqMC/M1iwC0MceL05.13HoFz/bai0/" |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 58 | when: '"{{ ansible_user }}" == "ubuntu"' |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 59 | |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 60 | - name: Authorize SSH Key |
| 61 | become: yes |
| 62 | authorized_key: |
| 63 | key="{{ pub_ssh_key }}" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 64 | user={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 65 | state=present |
| 66 | |
| 67 | - name: Verify Private SSH Key |
| 68 | become: yes |
| 69 | stat: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 70 | path=/home/{{ ansible_user }}/.ssh/id_rsa |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 71 | register: private_key |
| 72 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 73 | - name: Ensure SSH Key |
Andy Bavier | ceab230 | 2016-07-07 09:04:07 -0400 | [diff] [blame] | 74 | become: no |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 75 | copy: |
| 76 | src=files/{{ item }} |
Andy Bavier | ceab230 | 2016-07-07 09:04:07 -0400 | [diff] [blame] | 77 | dest={{ ansible_env['PWD'] }}/.ssh/{{ item }} |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 78 | owner={{ ansible_user }} |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 79 | mode=0600 |
| 80 | with_items: |
| 81 | - id_rsa |
| 82 | - id_rsa.pub |
David K. Bainbridge | 81bda33 | 2016-06-14 22:58:41 -0700 | [diff] [blame] | 83 | - config |
David K. Bainbridge | 39d0c78 | 2016-05-11 13:27:57 -0700 | [diff] [blame] | 84 | |
| 85 | - name: Ensure CORD SUDO |
| 86 | become: yes |
| 87 | copy: |
| 88 | src=files/99-cord-sudoers |
| 89 | dest=/etc/sudoers.d/99-cord-sudoers |
| 90 | owner=root |
| 91 | group=root |
| 92 | mode=0600 |
| 93 | |
David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 94 | - name: Ensure Utility Scripts |
| 95 | become: yes |
| 96 | copy: |
| 97 | src=files/{{ item }} |
| 98 | dest=/usr/local/bin/{{ item }} |
| 99 | owner=root |
| 100 | group=root |
| 101 | mode=0755 |
| 102 | with_items: |
| 103 | - delete-fabric-config |
| 104 | - delete-node-prov-state |
| 105 | - docker-ip |
| 106 | - fabric-pingall |
| 107 | - get-fabric-config |
| 108 | - get-node-prov-state |
| 109 | - remove-xos-components |
David K. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 110 | - remove-maas-components |
David K. Bainbridge | 1e4142d | 2016-08-04 10:01:58 -0700 | [diff] [blame] | 111 | - post-fabric-config |
David K. Bainbridge | e80fd39 | 2016-08-19 15:46:19 -0700 | [diff] [blame] | 112 | - pull-latest-docker-images |
David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 113 | |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 114 | - name: Verify Mellanox 40Gb NIC |
| 115 | shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true |
| 116 | register: mlx_nic_present |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 117 | changed_when: False |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 118 | |
| 119 | - name: Verify Intel 40Gb NIC |
| 120 | shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c "XL710 for 40GbE QSFP+" || true |
| 121 | register: intel_nic_present |
David K. Bainbridge | 0820cab | 2016-06-02 17:43:32 -0700 | [diff] [blame] | 122 | changed_when: False |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 123 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 124 | - name: Verify i40e Driver |
| 125 | command: modinfo --field=version i40e |
| 126 | register: i40e_version |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 127 | when: intel_nic_present.stdout != "0" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 128 | changed_when: False |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 129 | failed_when: False |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 130 | tags: |
| 131 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 132 | |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 133 | - name: Verify mlx4 Driver |
| 134 | command: modinfo --field=version mlx4_core |
| 135 | register: mlx4_version |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 136 | when: mlx_nic_present.stdout != "0" |
alshabib | e16ef4c | 2016-05-27 17:13:23 -0700 | [diff] [blame] | 137 | changed_when: False |
| 138 | failed_when: False |
| 139 | tags: |
| 140 | - interface_config |
| 141 | |
| 142 | - name: Update mlx4 Driver |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 143 | include: mlx4_driver.yml |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 144 | 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] | 145 | tags: |
| 146 | - interface_config |
| 147 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 148 | - name: Update i40e Driver |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 149 | include: i40e_driver.yml |
David K. Bainbridge | 10a8b98 | 2016-06-28 10:43:44 -0700 | [diff] [blame] | 150 | 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] | 151 | tags: |
| 152 | - interface_config |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 153 | |
alshabib | 54cdbb2 | 2016-06-03 16:37:01 -0700 | [diff] [blame] | 154 | - name: Load modules at boot |
| 155 | become: yes |
| 156 | lineinfile: |
| 157 | dest: /etc/modules |
| 158 | line: "{{ item }}" |
| 159 | with_items: |
| 160 | - lp |
| 161 | - loop |
| 162 | - rtc |
| 163 | - bonding |
| 164 | |
David K. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 165 | - name: Ensure Network Configuration |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 166 | become: yes |
David K. Bainbridge | a677d4e | 2016-09-11 20:01:32 -0700 | [diff] [blame] | 167 | include: networking.yml |
David K. Bainbridge | 4ec841c | 2016-05-11 22:10:15 -0700 | [diff] [blame] | 168 | tags: |
| 169 | - interface_config |