Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 1 | # Note: When the target == "cluster" the installer |
| 2 | # is running to install voltha in the cluster hosts. |
| 3 | # Whe the target == "installer" the installer is being |
| 4 | # created. |
| 5 | - name: A .ssh directory for the voltha user exists |
| 6 | file: |
| 7 | #path: "{{ ansible_env['HOME'] }}/.ssh" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 8 | path: "{{ target_voltha_home }}/.ssh" |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 9 | state: directory |
| 10 | owner: voltha |
| 11 | group: voltha |
| 12 | tags: [cluster_host] |
| 13 | |
| 14 | - name: known_hosts file is absent for the voltha user |
| 15 | file: |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 16 | path: "{{ target_voltha_home }}/.ssh/known_hosts" |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 17 | state: absent |
| 18 | tags: [cluster_host] |
| 19 | |
| 20 | - name: Known host checking is disabled |
| 21 | copy: |
| 22 | src: files/ssh_config |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 23 | dest: "{{ target_voltha_home }}/.ssh/config" |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 24 | owner: voltha |
| 25 | group: voltha |
| 26 | mode: 0600 |
| 27 | tags: [cluster_host] |
| 28 | |
| 29 | - name: Cluster host keys are propagated to all hosts in the cluster |
| 30 | copy: |
| 31 | src: files/.keys |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 32 | dest: "{{ target_voltha_home }}" |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 33 | owner: voltha |
| 34 | group: voltha |
| 35 | mode: 0600 |
| 36 | tags: [cluster_host] |
| 37 | |
| 38 | #- name: Required configuration directories are copied |
| 39 | # copy: |
| 40 | # src: "/home/vinstall/{{ item }}" |
| 41 | # dest: "{{ target_voltha_home }}" |
| 42 | # owner: voltha |
| 43 | # group: voltha |
| 44 | # with_items: |
| 45 | # - docker-py |
| 46 | # - netifaces |
| 47 | # - deb_files |
| 48 | # when: target == "cluster" |
| 49 | # tags: [cluster_host] |
| 50 | |
| 51 | - name: Required configuration directories are copied |
| 52 | synchronize: |
| 53 | src: "/home/vinstall/{{ item }}" |
| 54 | dest: "{{ target_voltha_home }}" |
| 55 | archive: no |
| 56 | owner: no |
| 57 | perms: no |
| 58 | recursive: yes |
| 59 | links: yes |
| 60 | with_items: |
| 61 | - docker-py |
| 62 | - netifaces |
| 63 | - deb_files |
| 64 | tags: [cluster-host] |
| 65 | |
| 66 | - name: apt lists are up-to-date |
Sergio Slobodrian | 5727e98 | 2017-06-28 21:02:27 -0400 | [diff] [blame] | 67 | synchronize: |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 68 | src: "/var/lib/apt/lists" |
Sergio Slobodrian | 5727e98 | 2017-06-28 21:02:27 -0400 | [diff] [blame] | 69 | dest: "/var/lib/apt/lists" |
| 70 | archive: no |
| 71 | owner: no |
| 72 | perms: no |
| 73 | rsync_opts: |
| 74 | - "--exclude=lock" |
| 75 | - "--exclude=partial" |
| 76 | recursive: yes |
| 77 | links: yes |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 78 | tags: [cluster_host] |
| 79 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 80 | #- name: upstart barrier filesystem loop mount script is installed |
| 81 | # copy: |
| 82 | # src: "/home/vinstall/losetup.conf" |
| 83 | # dest: /etc/init |
| 84 | # owner: root |
| 85 | # group: root |
| 86 | # mode: 0644 |
| 87 | # when: target == "cluster" |
| 88 | # tags: [cluster_host] |
| 89 | |
Sergio Slobodrian | 7c5e885 | 2017-07-31 20:17:14 -0400 | [diff] [blame] | 90 | #- name: pre-emptive strike to avoid errors during package installation |
| 91 | # apt: |
| 92 | # name: "{{ item }}" |
| 93 | # state: absent |
| 94 | # with_items: |
| 95 | # - ubuntu-core-launcher |
| 96 | # - snapd |
| 97 | # tags: [cluster_host] |
sathishg | 11fe23b | 2017-08-07 23:11:17 +0530 | [diff] [blame] | 98 | - name: A voltha directory under /var/log for voltha logs exists |
sathishg | b5d1c18 | 2017-07-13 14:20:19 +0530 | [diff] [blame] | 99 | file: |
sathishg | 11fe23b | 2017-08-07 23:11:17 +0530 | [diff] [blame] | 100 | path: "/var/log/voltha" |
sathishg | b5d1c18 | 2017-07-13 14:20:19 +0530 | [diff] [blame] | 101 | state: directory |
| 102 | tags: [cluster_host] |
| 103 | |
Sergio Slobodrian | f74fa07 | 2017-06-28 09:33:24 -0400 | [diff] [blame] | 104 | - name: Dependent software is installed (this can take about 10 Min, DONT'T PANIC, go for coffee instead) |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 105 | command: dpkg -R -i "{{ target_voltha_home }}/deb_files" |
| 106 | # ignore_errors: true |
| 107 | when: target == "cluster" |
| 108 | tags: [cluster_host] |
| 109 | |
| 110 | #- name: Dependent software is initialized |
| 111 | # command: apt-get -y -f install |
| 112 | # when: target == "cluster" |
| 113 | # tags: [cluster_host] |
| 114 | |
| 115 | - name: Python packages are installed |
| 116 | command: pip install {{ item }} --no-index --find-links "file://{{ target_voltha_home }}/{{ item }}" |
| 117 | with_items: |
| 118 | - docker-py |
| 119 | - netifaces |
| 120 | when: target == "cluster" |
| 121 | tags: [cluster_host] |
| 122 | |
| 123 | - name: Configuration directories are deleted |
| 124 | file: |
| 125 | path: "{{ target_voltha_home }}/{{ item }}" |
| 126 | state: absent |
| 127 | with_items: |
| 128 | - docker-py |
| 129 | - netifaces |
| 130 | - deb_files |
| 131 | when: target == "cluster" |
| 132 | tags: [cluster_host] |
| 133 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 134 | - name: Logging barrier file is created |
Sergio Slobodrian | c359b11 | 2017-08-30 16:45:43 -0400 | [diff] [blame] | 135 | command: "fallocate -l {{ logger_volume_size }}G {{ barrier_fs_dir }}/.logger-barrier-file" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 136 | when: target == "cluster" |
| 137 | tags: [cluster_host] |
| 138 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 139 | - name: Registry barrier file is created |
Sergio Slobodrian | c359b11 | 2017-08-30 16:45:43 -0400 | [diff] [blame] | 140 | command: "fallocate -l {{ registry_volume_size }}G {{ barrier_fs_dir }}/.registry-barrier-file" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 141 | when: target == "cluster" |
| 142 | tags: [cluster_host] |
| 143 | |
Sergio Slobodrian | c359b11 | 2017-08-30 16:45:43 -0400 | [diff] [blame] | 144 | #- name: Consul barrier file is created |
| 145 | # command: "fallocate -l {{ consul_volume_size }}G {{ barrier_fs_dir }}/.consul-barrier-file" |
| 146 | # when: target == "cluster" |
| 147 | # tags: [cluster_host] |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 148 | |
| 149 | - name: The logging barrier file is set up as a loop device |
| 150 | command: "losetup /dev/loop0 {{ barrier_fs_dir }}/.logger-barrier-file" |
| 151 | when: target == "cluster" |
| 152 | tags: [cluster_host] |
| 153 | |
| 154 | - name: The registry barrier file is set up as a loop device |
| 155 | command: "losetup /dev/loop1 {{ barrier_fs_dir }}/.registry-barrier-file" |
| 156 | when: target == "cluster" |
| 157 | tags: [cluster_host] |
| 158 | |
Sergio Slobodrian | c359b11 | 2017-08-30 16:45:43 -0400 | [diff] [blame] | 159 | #- name: The consul barrier file is set up as a loop device |
| 160 | # command: "losetup /dev/loop2 {{ barrier_fs_dir }}/.consul-barrier-file" |
| 161 | # when: target == "cluster" |
| 162 | # tags: [cluster_host] |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 163 | |
| 164 | - name: The xfs filesystem is created on the replicated barrier file systems |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 165 | filesystem: |
| 166 | fstype: xfs |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 167 | dev: "{{ item }}" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 168 | opts: -i size=512 |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 169 | with_items: |
| 170 | - /dev/loop0 |
| 171 | - /dev/loop1 |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 172 | when: target == "cluster" |
| 173 | tags: [cluster_host] |
| 174 | |
Sergio Slobodrian | c359b11 | 2017-08-30 16:45:43 -0400 | [diff] [blame] | 175 | #- name: The ext4 filesystem is created on the consul barrier volume |
| 176 | # filesystem: |
| 177 | # fstype: ext4 |
| 178 | # dev: /dev/loop2 |
| 179 | # when: target == "cluster" |
| 180 | # tags: [cluster_host] |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 181 | |
| 182 | - name: The loop devices that are no longer needed are removed |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 183 | command: "losetup -D" |
| 184 | when: target == "cluster" |
| 185 | tags: [cluster_host] |
| 186 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 187 | - name: The barrier fileystem files are owned by voltha |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 188 | file: |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 189 | path: "{{ barrier_fs_dir }}/{{ item }}" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 190 | mode: 0755 |
| 191 | owner: voltha |
| 192 | group: voltha |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 193 | with_items: |
| 194 | - ".registry-barrier-file" |
| 195 | - ".logger-barrier-file" |
Sergio Slobodrian | c359b11 | 2017-08-30 16:45:43 -0400 | [diff] [blame] | 196 | # - ".consul-barrier-file" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 197 | when: target == "cluster" |
| 198 | tags: [cluster_host] |
| 199 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 200 | - name: A mountpoint for the glusterfs registry brick is created |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 201 | file: |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 202 | path: "{{ barrier_fs_dir }}/reg_brick1" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 203 | state: directory |
| 204 | mode: 0755 |
| 205 | owner: voltha |
| 206 | group: voltha |
| 207 | when: target == "cluster" |
| 208 | tags: [cluster_host] |
| 209 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 210 | - name: A mountpoint for the glusterfs logging brick is created |
| 211 | file: |
| 212 | path: "{{ barrier_fs_dir }}/log_brick1" |
| 213 | state: directory |
| 214 | mode: 0755 |
| 215 | owner: voltha |
| 216 | group: voltha |
| 217 | when: target == "cluster" |
| 218 | tags: [cluster_host] |
| 219 | |
| 220 | - name: The replicated registry filesystem is mounted on boot |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 221 | mount: |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 222 | path: "{{ barrier_fs_dir }}/reg_brick1" |
| 223 | src: "{{ barrier_fs_dir }}/.registry-barrier-file" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 224 | fstype: xfs |
| 225 | opts: loop |
| 226 | state: mounted |
| 227 | when: target == "cluster" |
| 228 | tags: [cluster_host] |
| 229 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 230 | - name: The replicated logger filesystem is mounted on boot |
| 231 | mount: |
| 232 | path: "{{ barrier_fs_dir }}/log_brick1" |
| 233 | src: "{{ barrier_fs_dir }}/.logger-barrier-file" |
| 234 | fstype: xfs |
| 235 | opts: loop |
| 236 | state: mounted |
| 237 | when: target == "cluster" |
| 238 | tags: [cluster_host] |
| 239 | |
| 240 | - name: A directory for the registry glusterfs volume is created |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 241 | file: |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 242 | path: "{{ barrier_fs_dir }}/reg_brick1/registry_volume" |
| 243 | state: directory |
| 244 | mode: 0755 |
| 245 | owner: voltha |
| 246 | group: voltha |
| 247 | when: target == "cluster" |
| 248 | tags: [cluster_host] |
| 249 | |
| 250 | - name: A directory for the logging glusterfs volume is created |
| 251 | file: |
| 252 | path: "{{ barrier_fs_dir }}/log_brick1/logging_volume" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 253 | state: directory |
| 254 | mode: 0755 |
| 255 | owner: voltha |
| 256 | group: voltha |
| 257 | when: target == "cluster" |
| 258 | tags: [cluster_host] |
| 259 | |
Sergio Slobodrian | d49da36 | 2017-08-24 16:54:53 -0400 | [diff] [blame] | 260 | - name: Directories for voltha processes are created |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 261 | file: |
Sergio Slobodrian | d49da36 | 2017-08-24 16:54:53 -0400 | [diff] [blame] | 262 | path: "{{ target_voltha_dir }}/{{ item }}" |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 263 | state: directory |
| 264 | mode: 0755 |
| 265 | owner: voltha |
| 266 | group: voltha |
Sergio Slobodrian | d49da36 | 2017-08-24 16:54:53 -0400 | [diff] [blame] | 267 | with_items: |
| 268 | - registry_data |
| 269 | - consul/data |
| 270 | - consul/config |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 271 | when: target == "cluster" |
| 272 | tags: [cluster_host] |
| 273 | |
Sergio Slobodrian | c359b11 | 2017-08-30 16:45:43 -0400 | [diff] [blame] | 274 | #- name: The consul data filesystem is mounted on boot |
| 275 | # mount: |
| 276 | # path: "{{ target_voltha_dir }}/consul/data" |
| 277 | # src: "{{ barrier_fs_dir }}/.consul-barrier-file" |
| 278 | # fstype: ext4 |
| 279 | # opts: loop |
| 280 | # state: mounted |
| 281 | # when: target == "cluster" |
| 282 | # tags: [cluster_host] |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 283 | |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 284 | - name: The glusterfs service is started |
| 285 | service: |
| 286 | name: glusterfs-server |
| 287 | enabled: yes |
| 288 | state: started |
| 289 | when: target == "cluster" |
| 290 | tags: [cluster_host] |
| 291 | |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 292 | - name: The replicated registry filesystem is mounted on boot |
Sergio Slobodrian | 523ee78 | 2017-08-22 16:44:21 -0400 | [diff] [blame] | 293 | mount: |
| 294 | path: "{{ target_voltha_dir }}/registry_data" |
| 295 | src: "{{ inventory_hostname }}:/registry_volume" |
| 296 | fstype: glusterfs |
| 297 | opts: "defaults,_netdev,noauto,x-systemd.automount" |
| 298 | state: present |
| 299 | when: target == "cluster" |
| 300 | tags: [cluster_host] |
Sergio Slobodrian | 8725ea8 | 2017-08-27 23:47:41 -0400 | [diff] [blame] | 301 | |
| 302 | - name: The replicated logging filesystem is mounted on boot |
| 303 | mount: |
| 304 | path: "/var/log/voltha" |
| 305 | src: "{{ inventory_hostname }}:/logging_volume" |
| 306 | fstype: glusterfs |
| 307 | opts: "defaults,_netdev,noauto,x-systemd.automount" |
| 308 | state: present |
| 309 | when: target == "cluster" |
| 310 | tags: [cluster_host] |