blob: 3fd04dcb312c158041d400f303269ec7bcb24002 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
|
# #############################################################################
# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# #############################################################################
---
- name: remove osa log directory if exist
file:
path: /var/log/osa/
state: absent
- name: create osa log directory
file:
path: /var/log/osa/
state: directory
- name: remove osa user secrets if exist
shell: cp -rf /opt/openstack-ansible/etc/openstack_deploy/user_secrets.yml /etc/openstack_deploy/
- name: generate the osa password
command: python pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml
args:
chdir: "/opt/openstack-ansible/scripts"
- name: disable kernel update in rt_kvm scenario
lineinfile:
dest: /etc/ansible/roles/openstack_hosts/vars/ubuntu-16.04.yml
state: absent
regexp: 'linux-image-extra-*'
when: rt_kvm is defined and rt_kvm == "Enable"
- name: copy openstack_user_config
template:
src: openstack_user_config.yml.j2
dest: /etc/openstack_deploy/openstack_user_config.yml
- name: copy user_variables
template:
src: user_variables.yml.j2
dest: /etc/openstack_deploy/user_variables.yml
- name: check apt source
shell: "ping -c 2 {{ LOCAL_REPOSITORY_IP }} > /dev/null"
register: checkresult
ignore_errors: "true"
# yamllint disable rule:line-length
- name: add mariadb local repository
blockinfile:
dest: /etc/openstack_deploy/user_variables.yml
block: |
galera_client_apt_repo_url: "http://192.168.137.222/mariadb"
galera_repo_url: "[ arch=amd64 ] http://192.168.137.222/mariadb"
uca_apt_repo_url: "[ arch=amd64 ] http://192.168.137.222/ubuntu-cloud"
when:
- checkresult.rc == 0
- offline_deployment is defined and offline_deployment == "Disable"
- hostvars[hostvars[inventory_hostname]['groups']['controller'][0]]['local_mirror'] == 'Ubuntu'
- name: add libvirt into cinder packages
lineinfile:
dest: /etc/ansible/roles/os_cinder/vars/redhat-7.yml
insertafter: '^ - qemu-img-ev'
line: ' - libvirt'
- name: fix the problem of nova cell_v2 discovery
blockinfile:
dest: /etc/ansible/roles/os_nova/tasks/nova_db_post_setup.yml
insertafter: 'nova-manage cell_v2 discover_hosts'
block: |
# add retry
register: cell_v2_discovery
until: cell_v2_discovery == 0
retries: 10
delay: 5
ignore_errors: true
when: hostvars[hostvars[inventory_hostname]['groups']['controller'][0]]['local_mirror'] == 'Ubuntu'
- name: remove CentOS-Base.repo after ceph-osd
blockinfile:
dest: /etc/ansible/roles/ceph-osd/tasks/start_osds.yml
block: |
- name: remove empty yum base repo
shell: |
mv /etc/yum.repos.d/CentOS-Base.repo \
/etc/yum.repos.d/CentOS-Base.repo.bak;
when: hostvars[hostvars[inventory_hostname]['groups']['controller'][0]]['local_mirror'] == 'CentOS'
- name: fix the problem in pip_install
blockinfile:
dest: /etc/ansible/roles/pip_install/tasks/pre_install_yum.yml
insertafter: 'pip_install_package_state'
block: |
# add retry
register: repo_result
until: repo_result | success
retries: 5
delay: 10
when: hostvars[hostvars[inventory_hostname]['groups']['controller'][0]]['local_mirror'] == 'CentOS'
- name: copy chrony.conf
copy:
src: chrony.conf.j2
dest: /etc/ansible/roles/ansible-hardening/templates/
- name: update the directory of chrony key
lineinfile:
dest: /etc/ansible/roles/ansible-hardening/templates/chrony.conf.j2
regexp: '^keyfile'
line: 'keyfile /etc/chrony.keys'
when: hostvars[hostvars[inventory_hostname]['groups']['controller'][0]]['local_mirror'] == 'CentOS'
- name: add mariadb local repository
blockinfile:
dest: /etc/openstack_deploy/user_variables.yml
block: |
galera_client_apt_repo_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa xenial main"
galera_repo_url: "[ arch=amd64 ] http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa xenial main"
uca_apt_repo_url: "[ arch=amd64 ] http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa xenial main"
_rabbitmq_package_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/rabbitmq-server_3.6.9-1_all.deb"
percona_package_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/percona-xtrabackup-24_2.4.5-1.xenial_amd64.deb"
qpress_package_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/qpress_11-1.xenial_amd64.deb"
haproxy_hatop_download_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/hatop-0.7.7.tar.gz"
pip_upstream_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/get-pip.py"
ceph_stable_repo: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa"
ceph_pkg_source: "uca"
when: offline_deployment is defined and offline_deployment == "Enable"
- name: ignore galera client key
shell: |
sed -i '/galera-client-apt-keys/a\ when: offline_deployment is defined and offline_deployment == "Disable"' /etc/ansible/roles/galera_client/tasks/galera_client_install_apt.yml
when: offline_deployment is defined and offline_deployment == "Enable"
- name: ignore galera server key
shell: |
sed -i '/galera-apt-keys/a\ when: offline_deployment is defined and offline_deployment == "Disable"' /etc/ansible/roles/galera_server/tasks/galera_install_apt.yml
when: offline_deployment is defined and offline_deployment == "Enable"
# yamllint enable rule:line-length
- name: ignore git clone
lineinfile:
dest: /etc/ansible/roles/repo_build/tasks/repo_clone_git.yml
insertbefore: '^ async_status:'
line: ' ignore_errors: true'
when: offline_deployment is defined and offline_deployment == "Enable"
- name: add pbr to repo_pip_packages
lineinfile:
dest: /etc/ansible/roles/repo_build/defaults/main.yml
insertafter: '^ - cython'
line: ' - pbr'
when: offline_deployment is defined and offline_deployment == "Enable"
- name: ignore ceph special ppa
lineinfile:
dest: /etc/ansible/roles/ceph.ceph-common/tasks/installs/debian_ceph_repository.yml
insertafter: '^ - ppa:gluster/nfs-ganesha'
line: ' ignore_errors: true'
when: offline_deployment is defined and offline_deployment == "Enable"
- name: remove repo_build_pip_no_binary
lineinfile:
dest: /opt/openstack-ansible/inventory/group_vars/repo_all.yml
state: absent
regexp: "{{ item }}"
with_items: ['^repo_build_pip_no_binary:', '^ - libvirt-python']
when: offline_deployment is defined and offline_deployment == "Enable"
- name: copy venv script
copy:
src: "op-venv-script.sh"
dest: "/opt/op-venv-script.sh"
when: offline_deployment is defined and offline_deployment == "Enable"
- name: update venv script
blockinfile:
dest: /etc/ansible/roles/repo_build/tasks/repo_venv_build.yml
insertbefore: '^- name: Run venv process script'
block: |
- name: update venv script
copy:
src: "/opt/op-venv-script.sh"
dest: "/opt/op-venv-script.sh"
when: offline_deployment is defined and offline_deployment == "Enable"
- name: copy absolute requirement
copy:
src: "requirements_absolute_requirements.txt"
dest: "/opt/requirements_absolute_requirements.txt"
when: offline_deployment is defined and offline_deployment == "Enable"
- name: update absolute requirements
blockinfile:
dest: /etc/ansible/roles/repo_build/tasks/repo_post_build.yml
insertbefore: '^- name: Copy get-pip script into release folder'
block: |
{% raw %}
- name: update absolute requirements
copy:
src: "/opt/requirements_absolute_requirements.txt"
dest: "{{ repo_build_release_path }}/requirements_absolute_requirements.txt"
{% endraw %}
when: offline_deployment is defined and offline_deployment == "Enable"
# This is a bug in ocata, will be removed in the future
# - name: limit the version of networking-sfc in os_tacker
# shell: |
# sed -i 's/networking-sfc$/networking-sfc=={{ networking_sfc_version }}/g' \
# /etc/ansible/roles/os_tacker/defaults/main.yml
- name: add rally and tempest to requirement.txt
blockinfile:
dest: /etc/ansible/roles/repo_build/tasks/repo_pre_build.yml
insertbefore: '^- include: repo_clone_git.yml'
block: |
{% raw %}
- name: add rally and tempest
blockinfile:
dest: "{{ repo_build_release_path }}/requirements.txt"
insertafter: '^wheel'
block: |
rally
tempest
{% endraw %}
when: offline_deployment is defined and offline_deployment == "Enable"
- name: add lxc image for offline deloyment
blockinfile:
dest: /etc/ansible/roles/lxc_hosts/tasks/main.yml
insertbefore: '^- include: lxc_post_install.yml'
block: |
- name: add lxc image to the lxc cache dir
get_url:
url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/download.tar.gz"
dest: "/opt/download.tar.gz"
- name: unarchive lxc image tarball
command: su -s /bin/sh -c "tar -zxf /opt/download.tar.gz -C /var/cache/lxc/"
- name: clear tarball
file:
path: "/opt/download.tar.gz"
state: absent
when: offline_deployment is defined and offline_deployment == "Enable"
- name: configure pip.conf for lxc hosts and repo lxc
template:
src: pip.conf.j2
dest: "/etc/ansible/roles/pip_install/templates/pip.conf.j2"
when: offline_deployment is defined and offline_deployment == "Enable"
- name: set set-upper-constraints downloading
blockinfile:
dest: /opt/openstack-ansible/playbooks/common-tasks/set-upper-constraints.yml
insertafter: '^# Use https'
block: |
- name: download upper-constraints.txt
get_url:
url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/upper-constraints.txt"
dest: /opt/
when: offline_deployment is defined and offline_deployment == "Enable"
- name: modify set-upper-constraints
shell: |
sed -i 's#\(--constraint\).*$#\1 /opt/upper-constraints.txt#g' \
/opt/openstack-ansible/playbooks/common-tasks/set-upper-constraints.yml ;
when: offline_deployment is defined and offline_deployment == "Enable"
- name: copy apt.conf for lxc
copy:
src: apt.conf
dest: "/etc/ansible/roles/lxc_container_create/files/apt.conf"
when: offline_deployment is defined and offline_deployment == "Enable"
- name: add apt.conf for lxc
blockinfile:
dest: "/etc/ansible/roles/lxc_container_create/tasks/container_create.yml"
insertbefore: '^- name: Create hostname'
block: |
- name: add apt.conf
copy:
src: apt.conf
dest: "/etc/apt/apt.conf"
when: offline_deployment is defined and offline_deployment == "Enable"
- name: copy cinder.yml
copy:
src: cinder.yml
dest: /etc/openstack_deploy/env.d/cinder.yml
- name: copy ansible.cfg
template:
src: ansible.cfg
dest: /opt/openstack-ansible/playbooks/
- name: copy user_ceph.yml
copy:
src: user_ceph.yml
dest: /etc/openstack_deploy/user_ceph.yml
when:
- hostvars[inventory_hostname]['groups']['ceph_mon'] is defined and
"{{ hostvars[inventory_hostname]['groups']['ceph_mon'] | length > 0 }}"
- hostvars[inventory_hostname]['groups']['ceph_osd'] is defined and
"{{ hostvars[inventory_hostname]['groups']['ceph_osd'] | length > 0 }}"
- name: render ceph.yml.j2
template:
src: ceph.yml.j2
dest: /etc/openstack_deploy/conf.d/ceph.yml
when:
- hostvars[inventory_hostname]['groups']['ceph_mon'] is defined and
"{{ hostvars[inventory_hostname]['groups']['ceph_mon'] | length > 0 }}"
- hostvars[inventory_hostname]['groups']['ceph_osd'] is defined and
"{{ hostvars[inventory_hostname]['groups']['ceph_osd'] | length > 0 }}"
- name: render user_variables_ceph.yml.j2
template:
src: user_variables_ceph.yml.j2
dest: /etc/openstack_deploy/user_variables_ceph.yml
when:
- hostvars[inventory_hostname]['groups']['ceph_mon'] is defined and
"{{ hostvars[inventory_hostname]['groups']['ceph_mon'] | length > 0 }}"
- hostvars[inventory_hostname]['groups']['ceph_osd'] is defined and
"{{ hostvars[inventory_hostname]['groups']['ceph_osd'] | length > 0 }}"
- name: adapt no ha scenario
include: noha.yml
when:
- "{{ hostvars[inventory_hostname]['groups']['controller'] | length < 2 }}"
- name: copy collect-log.sh to /opt
copy:
src: collect-log.sh
dest: /opt/collect-log.sh
- name: copy collect-log.yml to /opt
copy:
src: collect-log.yml
dest: /opt/collect-log.yml
# - name: change repore build
# lineinfile:
# dest: /etc/ansible/roles/repo_build/tasks/main.yml
# insertafter: "^- include: repo_post_build.yml"
# line: "- include: repo_fix_pandas.yml"
- include: fix_rescue.yml
- name: rm command "rm -f /etc/resolv.conf" in cache_prep_commands
lineinfile:
dest: /etc/ansible/roles/lxc_hosts/vars/ubuntu-16.04.yml
regexp: 'rm -f /etc/resolv.conf$'
line: ' echo "ok"'
backrefs: 'yes'
- name: add command "rm /etc/resolv.conf || true" in cache_prep_commands
lineinfile:
dest: /etc/ansible/roles/lxc_hosts/vars/ubuntu-16.04.yml
insertafter: '^ cache_prep_commands:'
line: ' rm /etc/resolv.conf || true'
- name: set pre-staged retry to 120
replace:
dest: /etc/ansible/roles/lxc_hosts/tasks/lxc_cache_preparation_systemd_new.yml
regexp: '^ retries: 60'
replace: ' retries: 120'
- name: copy lxc_cache_prestage.patch
copy:
src: lxc_cache_prestage.patch
dest: /etc/ansible/roles/lxc_hosts/tasks/lxc_cache_prestage.patch
- name: patch lxc_cache_prestage.yml
shell:
patch -p0 < lxc_cache_prestage.patch
args:
chdir: /etc/ansible/roles/lxc_hosts/tasks/
|