blob: 531b827c34e60e27740b6748e010a21e6c588ab1 [file] [log] [blame]
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -04001# 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 Slobodrian523ee782017-08-22 16:44:21 -04008 path: "{{ target_voltha_home }}/.ssh"
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -04009 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 Slobodrian523ee782017-08-22 16:44:21 -040016 path: "{{ target_voltha_home }}/.ssh/known_hosts"
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040017 state: absent
18 tags: [cluster_host]
19
20- name: Known host checking is disabled
21 copy:
22 src: files/ssh_config
Sergio Slobodrian523ee782017-08-22 16:44:21 -040023 dest: "{{ target_voltha_home }}/.ssh/config"
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040024 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 Slobodrian523ee782017-08-22 16:44:21 -040032 dest: "{{ target_voltha_home }}"
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040033 owner: voltha
34 group: voltha
35 mode: 0600
36 tags: [cluster_host]
37
38#- name: Required configuration directories are copied
39# copy:
Stephane Barbariebcea2f42018-03-02 18:46:32 -050040# src: "{{ install_source }}/{{ item }}"
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040041# 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:
Stephane Barbariebcea2f42018-03-02 18:46:32 -050053 src: "{{ install_source }}/{{ item }}"
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040054 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
Sergio Slobodrian86843702017-09-05 23:22:39 -040066- name: Required configuration scripts are copied
67 synchronize:
Stephane Barbariebcea2f42018-03-02 18:46:32 -050068 src: "{{ install_source }}/{{ item }}"
Sergio Slobodrian86843702017-09-05 23:22:39 -040069 dest: "{{ target_voltha_home }}"
70 archive: no
71 owner: no
72 perms: no
73 recursive: no
74 links: yes
75 with_items:
76 - sort_packages.sh
77 - sort_packages.py
78 - install_packages.sh
79 tags: [cluster-host]
80
81- name: The installer scripts are made executable
82 file:
83 path: "{{target_voltha_home }}/{{ item }}"
84 mode: 0744
85 with_items:
86 - sort_packages.sh
87 - sort_packages.py
88 - install_packages.sh
89 tags: [installer]
90
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040091- name: apt lists are up-to-date
Sergio Slobodrian5727e982017-06-28 21:02:27 -040092 synchronize:
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040093 src: "/var/lib/apt/lists"
Sergio Slobodrian5727e982017-06-28 21:02:27 -040094 dest: "/var/lib/apt/lists"
95 archive: no
96 owner: no
97 perms: no
98 rsync_opts:
99 - "--exclude=lock"
100 - "--exclude=partial"
101 recursive: yes
102 links: yes
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -0400103 tags: [cluster_host]
104
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400105#- name: upstart barrier filesystem loop mount script is installed
106# copy:
Stephane Barbariebcea2f42018-03-02 18:46:32 -0500107# src: "{{ install_source }}/losetup.conf"
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400108# dest: /etc/init
109# owner: root
110# group: root
111# mode: 0644
112# when: target == "cluster"
113# tags: [cluster_host]
114
Sergio Slobodrian7c5e8852017-07-31 20:17:14 -0400115#- name: pre-emptive strike to avoid errors during package installation
116# apt:
117# name: "{{ item }}"
118# state: absent
119# with_items:
120# - ubuntu-core-launcher
121# - snapd
122# tags: [cluster_host]
sathishg11fe23b2017-08-07 23:11:17 +0530123- name: A voltha directory under /var/log for voltha logs exists
sathishgb5d1c182017-07-13 14:20:19 +0530124 file:
sathishg11fe23b2017-08-07 23:11:17 +0530125 path: "/var/log/voltha"
sathishgb5d1c182017-07-13 14:20:19 +0530126 state: directory
127 tags: [cluster_host]
128
Sergio Slobodrianf74fa072017-06-28 09:33:24 -0400129- name: Dependent software is installed (this can take about 10 Min, DONT'T PANIC, go for coffee instead)
Sergio Slobodrian86843702017-09-05 23:22:39 -0400130 command: "{{ target_voltha_home }}/install_packages.sh"
131# command: dpkg -R -i "{{ target_voltha_home }}/deb_files"
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -0400132 when: target == "cluster"
133 tags: [cluster_host]
134
135#- name: Dependent software is initialized
136# command: apt-get -y -f install
137# when: target == "cluster"
138# tags: [cluster_host]
139
140- name: Python packages are installed
141 command: pip install {{ item }} --no-index --find-links "file://{{ target_voltha_home }}/{{ item }}"
142 with_items:
143 - docker-py
144 - netifaces
145 when: target == "cluster"
146 tags: [cluster_host]
147
Sergio Slobodrian86843702017-09-05 23:22:39 -0400148# To debug package installation, comment this out so review temporary interim
149# files.
150- name: Configuration directories and files are deleted
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -0400151 file:
152 path: "{{ target_voltha_home }}/{{ item }}"
153 state: absent
154 with_items:
155 - docker-py
156 - netifaces
Sergio Slobodrian86843702017-09-05 23:22:39 -0400157 - sort_packages.sh
158 - sort_packages.py
159 - install_packages.sh
160 - deb_files1
161 - deb_files2
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -0400162 when: target == "cluster"
163 tags: [cluster_host]
164
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400165- name: Logging barrier file is created
Sergio Slobodrianc359b112017-08-30 16:45:43 -0400166 command: "fallocate -l {{ logger_volume_size }}G {{ barrier_fs_dir }}/.logger-barrier-file"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400167 when: target == "cluster"
168 tags: [cluster_host]
169
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400170- name: Registry barrier file is created
Sergio Slobodrianc359b112017-08-30 16:45:43 -0400171 command: "fallocate -l {{ registry_volume_size }}G {{ barrier_fs_dir }}/.registry-barrier-file"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400172 when: target == "cluster"
173 tags: [cluster_host]
174
Sergio Slobodrianc359b112017-08-30 16:45:43 -0400175#- name: Consul barrier file is created
176# command: "fallocate -l {{ consul_volume_size }}G {{ barrier_fs_dir }}/.consul-barrier-file"
177# when: target == "cluster"
178# tags: [cluster_host]
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400179
180- name: The logging barrier file is set up as a loop device
181 command: "losetup /dev/loop0 {{ barrier_fs_dir }}/.logger-barrier-file"
182 when: target == "cluster"
183 tags: [cluster_host]
184
185- name: The registry barrier file is set up as a loop device
186 command: "losetup /dev/loop1 {{ barrier_fs_dir }}/.registry-barrier-file"
187 when: target == "cluster"
188 tags: [cluster_host]
189
Sergio Slobodrianc359b112017-08-30 16:45:43 -0400190#- name: The consul barrier file is set up as a loop device
191# command: "losetup /dev/loop2 {{ barrier_fs_dir }}/.consul-barrier-file"
192# when: target == "cluster"
193# tags: [cluster_host]
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400194
195- name: The xfs filesystem is created on the replicated barrier file systems
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400196 filesystem:
197 fstype: xfs
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400198 dev: "{{ item }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400199 opts: -i size=512
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400200 with_items:
201 - /dev/loop0
202 - /dev/loop1
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400203 when: target == "cluster"
204 tags: [cluster_host]
205
Sergio Slobodrianc359b112017-08-30 16:45:43 -0400206#- name: The ext4 filesystem is created on the consul barrier volume
207# filesystem:
208# fstype: ext4
209# dev: /dev/loop2
210# when: target == "cluster"
211# tags: [cluster_host]
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400212
213- name: The loop devices that are no longer needed are removed
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400214 command: "losetup -D"
215 when: target == "cluster"
216 tags: [cluster_host]
217
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400218- name: The barrier fileystem files are owned by voltha
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400219 file:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400220 path: "{{ barrier_fs_dir }}/{{ item }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400221 mode: 0755
222 owner: voltha
223 group: voltha
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400224 with_items:
225 - ".registry-barrier-file"
226 - ".logger-barrier-file"
Sergio Slobodrianc359b112017-08-30 16:45:43 -0400227# - ".consul-barrier-file"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400228 when: target == "cluster"
229 tags: [cluster_host]
230
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400231- name: A mountpoint for the glusterfs registry brick is created
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400232 file:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400233 path: "{{ barrier_fs_dir }}/reg_brick1"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400234 state: directory
235 mode: 0755
236 owner: voltha
237 group: voltha
238 when: target == "cluster"
239 tags: [cluster_host]
240
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400241- name: A mountpoint for the glusterfs logging brick is created
242 file:
243 path: "{{ barrier_fs_dir }}/log_brick1"
244 state: directory
245 mode: 0755
246 owner: voltha
247 group: voltha
248 when: target == "cluster"
249 tags: [cluster_host]
250
251- name: The replicated registry filesystem is mounted on boot
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400252 mount:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400253 path: "{{ barrier_fs_dir }}/reg_brick1"
254 src: "{{ barrier_fs_dir }}/.registry-barrier-file"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400255 fstype: xfs
256 opts: loop
257 state: mounted
258 when: target == "cluster"
259 tags: [cluster_host]
260
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400261- name: The replicated logger filesystem is mounted on boot
262 mount:
263 path: "{{ barrier_fs_dir }}/log_brick1"
264 src: "{{ barrier_fs_dir }}/.logger-barrier-file"
265 fstype: xfs
266 opts: loop
267 state: mounted
268 when: target == "cluster"
269 tags: [cluster_host]
270
271- name: A directory for the registry glusterfs volume is created
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400272 file:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400273 path: "{{ barrier_fs_dir }}/reg_brick1/registry_volume"
274 state: directory
275 mode: 0755
276 owner: voltha
277 group: voltha
278 when: target == "cluster"
279 tags: [cluster_host]
280
281- name: A directory for the logging glusterfs volume is created
282 file:
283 path: "{{ barrier_fs_dir }}/log_brick1/logging_volume"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400284 state: directory
285 mode: 0755
286 owner: voltha
287 group: voltha
288 when: target == "cluster"
289 tags: [cluster_host]
290
Sergio Slobodriand49da362017-08-24 16:54:53 -0400291- name: Directories for voltha processes are created
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400292 file:
Sergio Slobodriand49da362017-08-24 16:54:53 -0400293 path: "{{ target_voltha_dir }}/{{ item }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400294 state: directory
295 mode: 0755
296 owner: voltha
297 group: voltha
Sergio Slobodriand49da362017-08-24 16:54:53 -0400298 with_items:
299 - registry_data
300 - consul/data
301 - consul/config
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400302 when: target == "cluster"
303 tags: [cluster_host]
304
Sergio Slobodrianc359b112017-08-30 16:45:43 -0400305#- name: The consul data filesystem is mounted on boot
306# mount:
307# path: "{{ target_voltha_dir }}/consul/data"
308# src: "{{ barrier_fs_dir }}/.consul-barrier-file"
309# fstype: ext4
310# opts: loop
311# state: mounted
312# when: target == "cluster"
313# tags: [cluster_host]
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400314
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400315- name: The glusterfs service is started
316 service:
Stephane Barbarie2cbffca2018-03-26 16:20:03 -0400317 name: glusterd
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400318 enabled: yes
319 state: started
320 when: target == "cluster"
321 tags: [cluster_host]
322
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400323- name: The replicated registry filesystem is mounted on boot
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400324 mount:
325 path: "{{ target_voltha_dir }}/registry_data"
326 src: "{{ inventory_hostname }}:/registry_volume"
327 fstype: glusterfs
328 opts: "defaults,_netdev,noauto,x-systemd.automount"
329 state: present
330 when: target == "cluster"
331 tags: [cluster_host]
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400332
333- name: The replicated logging filesystem is mounted on boot
334 mount:
335 path: "/var/log/voltha"
336 src: "{{ inventory_hostname }}:/logging_volume"
337 fstype: glusterfs
338 opts: "defaults,_netdev,noauto,x-systemd.automount"
339 state: present
340 when: target == "cluster"
341 tags: [cluster_host]