blob: 834d34a71ea8346bf6f85e7537439fbf3790bfa0 [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:
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 Slobodrian5727e982017-06-28 21:02:27 -040067 synchronize:
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040068 src: "/var/lib/apt/lists"
Sergio Slobodrian5727e982017-06-28 21:02:27 -040069 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 Slobodrianba9cbd82017-06-22 11:45:49 -040078 tags: [cluster_host]
79
Sergio Slobodrian8725ea82017-08-27 23:47:41 -040080#- 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 Slobodrian7c5e8852017-07-31 20:17:14 -040090#- 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]
sathishg11fe23b2017-08-07 23:11:17 +053098- name: A voltha directory under /var/log for voltha logs exists
sathishgb5d1c182017-07-13 14:20:19 +053099 file:
sathishg11fe23b2017-08-07 23:11:17 +0530100 path: "/var/log/voltha"
sathishgb5d1c182017-07-13 14:20:19 +0530101 state: directory
102 tags: [cluster_host]
103
Sergio Slobodrianf74fa072017-06-28 09:33:24 -0400104- name: Dependent software is installed (this can take about 10 Min, DONT'T PANIC, go for coffee instead)
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -0400105 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 Slobodrian8725ea82017-08-27 23:47:41 -0400134- name: Logging barrier file is created
135 command: "dd if=/dev/zero of={{ barrier_fs_dir }}/.logger-barrier-file cbs=100M bs=1G count={{ logger_volume_size }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400136 when: target == "cluster"
137 tags: [cluster_host]
138
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400139- name: Registry barrier file is created
140 command: "dd if=/dev/zero of={{ barrier_fs_dir }}/.registry-barrier-file cbs=100M bs=1G count={{ registry_volume_size }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400141 when: target == "cluster"
142 tags: [cluster_host]
143
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400144- name: Consul barrier file is created
145 command: "dd if=/dev/zero of={{ barrier_fs_dir }}/.consul-barrier-file cbs=100M bs=1G count={{ consul_volume_size }}"
146 when: target == "cluster"
147 tags: [cluster_host]
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
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]
163
164- name: The xfs filesystem is created on the replicated barrier file systems
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400165 filesystem:
166 fstype: xfs
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400167 dev: "{{ item }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400168 opts: -i size=512
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400169 with_items:
170 - /dev/loop0
171 - /dev/loop1
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400172 when: target == "cluster"
173 tags: [cluster_host]
174
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400175- 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]
181
182- name: The loop devices that are no longer needed are removed
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400183 command: "losetup -D"
184 when: target == "cluster"
185 tags: [cluster_host]
186
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400187- name: The barrier fileystem files are owned by voltha
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400188 file:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400189 path: "{{ barrier_fs_dir }}/{{ item }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400190 mode: 0755
191 owner: voltha
192 group: voltha
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400193 with_items:
194 - ".registry-barrier-file"
195 - ".logger-barrier-file"
196 - ".consul-barrier-file"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400197 when: target == "cluster"
198 tags: [cluster_host]
199
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400200- name: A mountpoint for the glusterfs registry brick is created
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400201 file:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400202 path: "{{ barrier_fs_dir }}/reg_brick1"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400203 state: directory
204 mode: 0755
205 owner: voltha
206 group: voltha
207 when: target == "cluster"
208 tags: [cluster_host]
209
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400210- 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 Slobodrian523ee782017-08-22 16:44:21 -0400221 mount:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400222 path: "{{ barrier_fs_dir }}/reg_brick1"
223 src: "{{ barrier_fs_dir }}/.registry-barrier-file"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400224 fstype: xfs
225 opts: loop
226 state: mounted
227 when: target == "cluster"
228 tags: [cluster_host]
229
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400230- 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 Slobodrian523ee782017-08-22 16:44:21 -0400241 file:
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400242 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 Slobodrian523ee782017-08-22 16:44:21 -0400253 state: directory
254 mode: 0755
255 owner: voltha
256 group: voltha
257 when: target == "cluster"
258 tags: [cluster_host]
259
Sergio Slobodriand49da362017-08-24 16:54:53 -0400260- name: Directories for voltha processes are created
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400261 file:
Sergio Slobodriand49da362017-08-24 16:54:53 -0400262 path: "{{ target_voltha_dir }}/{{ item }}"
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400263 state: directory
264 mode: 0755
265 owner: voltha
266 group: voltha
Sergio Slobodriand49da362017-08-24 16:54:53 -0400267 with_items:
268 - registry_data
269 - consul/data
270 - consul/config
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400271 when: target == "cluster"
272 tags: [cluster_host]
273
Sergio Slobodrian8725ea82017-08-27 23:47:41 -0400274- 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]
283
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400284- 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 Slobodrian8725ea82017-08-27 23:47:41 -0400292- name: The replicated registry filesystem is mounted on boot
Sergio Slobodrian523ee782017-08-22 16:44:21 -0400293 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 Slobodrian8725ea82017-08-27 23:47:41 -0400301
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]