-
Notifications
You must be signed in to change notification settings - Fork 16
/
overcloud.yml
359 lines (314 loc) · 15.1 KB
/
overcloud.yml
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
---
- hosts: undercloud
gather_facts: yes
tasks:
- block:
# RHBZ 1756492
- name: exclude ceph images
lineinfile:
path: /home/stack/containers-prepare-parameter.yaml
insertafter: "- push_destination: true"
line: ' excludes:'
- name: exclude ceph images
lineinfile:
path: /home/stack/containers-prepare-parameter.yaml
insertafter: " excludes:"
line: ' - ceph'
when: (ceph_enabled != true) and (osp_release|int > 13)
- name: get tht version
shell: |
grep "heat_template_version" /usr/share/openstack-tripleo-heat-templates/overcloud.j2.yaml | cut -d ':' -f2
register: tht_version
- name: set heat_template_version
set_fact:
heat_template_version: "{{ tht_version.stdout }}"
- block:
- name: generate firstboot-nvme.yaml
template:
src: "firstboot-nvme.yaml.j2"
dest: "/home/stack/firstboot-nvme.yaml"
- name: override the firstboot.yaml
template:
src: "firstboot.yaml.j2.j2"
dest: "{{ hostvars['localhost'].ansible_user_dir }}/.infrared/plugins/tripleo-overcloud/templates/firstboot.yaml.j2"
delegate_to: localhost
when: passthrough_nvme is defined or mount_nvme is defined
- name: generate wipe-disks.yaml
template:
src: "firstboot-wipe-disks.yaml.j2"
dest: "/home/stack/wipe-disks.yaml"
when: ceph_enabled and (clean_nodes != true)
- name: generate wipe-disk.sh
template:
src: "wipe-disk.sh.j2"
dest: "/home/stack/wipe-disk.sh"
when: ceph_enabled and (clean_nodes != true)
- name: remove the templates dir
file:
state: absent
path: /home/stack/templates
ignore_errors: true
- name: workaround for BZ 2123252
become: true
shell: |
dnf install containernetworking-plugins -y
sed -i 's/netavark/cni/g' /etc/containers/containers.conf
when: osp_release|int == 17
- hosts: localhost
gather_facts: yes
tasks:
- name: get compute count
shell: |
cat compute_count
register: compute_count
- name: set fact compute count
set_fact:
compute_count: "{{ compute_count.stdout|int }}"
- name: set nvme parameter_defaults
vars:
nvme_params: {
NovaSchedulerDefaultFilters: ['RetryFilter','AvailabilityZoneFilter','ComputeFilter','ComputeCapabilitiesFilter','ImagePropertiesFilter','ServerGroupAntiAffinityFilter','ServerGroupAffinityFilter','PciPassthroughFilter'],
NovaSchedulerAvailableFilters: ['nova.scheduler.filters.all_filters'],
NovaSchedulerMaxAttempts: "{{ compute_count }}",
ControllerParameters: {
NovaPCIPassthrough: [{
vendor_id: "{{ passthrough_nvme.vendor_id }}",
product_id: "{{ passthrough_nvme.product_id }}",
address: "{{ passthrough_nvme.address }}" }]
},
ControllerExtraConfig: {
"nova::pci::aliases": [{
name: 'nvme',
vendor_id: "{{ passthrough_nvme.vendor_id }}",
product_id: "{{ passthrough_nvme.product_id }}",
device_type: 'type-PCI'}]
},
ComputeParameters: {
NovaPCIPassthrough: [{
vendor_id: "{{ passthrough_nvme.vendor_id }}",
product_id: "{{ passthrough_nvme.product_id }}",
address: "{{ passthrough_nvme.address }}" }]
},
ComputeExtraConfig: {
"nova::pci::aliases": [{
name: 'nvme',
vendor_id: "{{ passthrough_nvme.vendor_id }}",
product_id: "{{ passthrough_nvme.product_id }}",
device_type: 'type-PCI'}]
},
ComputeKernelArgs: "intel_iommu=on iommu=pt",
}
set_fact:
parameter_defaults: "{{ parameter_defaults|default({}) | combine(nvme_params) }}"
when: passthrough_nvme is defined
- name: set tls-everywhere parameter_defaults
vars:
tls_e_params: {
DnsSearchDomains: ["{{ ipa_domain }}"],
CloudDomain: "{{ ipa_domain }}",
CloudName: "overcloud.{{ ipa_domain }}",
CloudNameInternal: "overcloud.internalapi.{{ ipa_domain }}",
CloudNameStorage: "overcloud.storage.{{ ipa_domain }}",
CloudNameStorageManagement: "overcloud.storagemgmt.{{ ipa_domain }}",
CloudNameCtlplane: "overcloud.ctlplane.{{ ipa_domain }}",
IdMServer: "{{ idm_host_fqdn }}",
IdMDomain: "{{ ipa_domain }}",
IdMInstallClientPackages: true
}
set_fact:
parameter_defaults: "{{ parameter_defaults|default({}) | combine(tls_e_params) }}"
when: tls_everywhere == true
- name: set barbican parameter_defaults
vars:
barbican_params: {
BarbicanSimpleCryptoGlobalDefault: true
}
set_fact:
parameter_defaults: "{{ parameter_defaults|default({}) | combine(barbican_params) }}"
when: barbican_enabled == true
- name: set resource_registry tls-everywhere parameters
vars:
res_reg: "{{ resource_registry|default([]) }}"
set_fact:
resource_registry: "{{ res_reg + ['OS::TripleO::Services::IpaClient=/usr/share/openstack-tripleo-heat-templates/deployment/ipa/ipaservices-baremetal-ansible.yaml'] }}"
when: tls_everywhere == true
- name: add templates for tls-everywhere to extra_templates
vars:
tls_e_templates:
- /usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-everywhere-endpoints-dns.yaml
- /usr/share/openstack-tripleo-heat-templates/environments/services/haproxy-public-tls-certmonger.yaml
- /usr/share/openstack-tripleo-heat-templates/environments/ssl/enable-internal-tls.yaml
set_fact:
extra_templates: "{{ extra_templates | default([]) + tls_e_templates }}"
when: tls_everywhere == true
- name: add templates for barbican to extra_templates
vars:
barbican_templates:
- /usr/share/openstack-tripleo-heat-templates/environments/services/barbican.yaml
- /usr/share/openstack-tripleo-heat-templates/environments/barbican-backend-simple-crypto.yaml
set_fact:
extra_templates: "{{ extra_templates | default([]) + barbican_templates }}"
when: barbican_enabled == true
- name: add tripleo_heat_templates to template
set_fact:
config_template: "{{ config_template | default({}) | combine({'tripleo_heat_templates': extra_templates}) }}"
when: extra_templates is defined
- name: add parameter_defaults to template
set_fact:
config_template: "{{ config_template | default({}) | combine({'custom_templates': {'parameter_defaults': parameter_defaults} }) }}"
when: parameter_defaults is defined
- name: copy template content to extra template file
copy:
dest: "{{ infrared_dir }}/plugins/tripleo-overcloud/vars/overcloud/templates/extra.yml"
content: "{{ config_template | to_nice_yaml }}"
when: config_template is defined
- name: update extra.yml
lineinfile:
path: "{{ infrared_dir }}/plugins/tripleo-overcloud/vars/overcloud/templates/extra.yml"
regexp: 'ComputeExtraConfig'
line: "{{ ' Compute' + pci_node_type + 'PCIExtraConfig:' }}"
when: passthrough_nvme is defined and pci_node_type is defined
- name: update extra.yml
lineinfile:
path: "{{ infrared_dir }}/plugins/tripleo-overcloud/vars/overcloud/templates/extra.yml"
regexp: 'ComputeParameters'
line: "{{ ' Compute' + pci_node_type + 'PCIParameters:' }}"
when: passthrough_nvme is defined and pci_node_type is defined
# tripleo_heat_templates and resource_registry will define the files.
# Check if these exist in the undercloud and copy them from jetpack/files
# if they don't exist.
- name: Enable overcloud deployment with extra user defined templates
block:
- name: Check if the templates exist on the undercloud
stat:
path: "{{ item }}"
register: env_files
loop: "{{ extra_templates }}"
when: extra_templates is defined
delegate_to: "{{ undercloud_hostname }}"
vars:
ansible_python_interpreter: "{{ python_interpreter }}"
ansible_user: "stack"
- name: Copy files to undercloud if they do not exist
copy:
src: "{{ item.item| basename }}"
dest: "/home/stack/"
loop: "{{ env_files.results }}"
when: (item.item | basename != "enable-internal-tls.yaml") and (extra_templates is defined) and (not item.stat.exists)
delegate_to: "{{ undercloud_hostname }}"
vars:
ansible_python_interpreter: "{{ python_interpreter }}"
ansible_user: "stack"
when: (extra_templates is defined and extra_templates|length>0 and (not novaless_prov))
- name: Enable overcloud deployment with resource registry templates
block:
- name: get filenames for resource registry
vars:
res_reg_files: []
set_fact:
res_reg_files: "{{ res_reg_files + [ item.split('=')[1] ] }}"
when: "'OS::Heat::None' not in item"
loop: "{{ resource_registry }}"
- name: Check if the resource registry templates exist on the undercloud
stat:
path: "{{ item }}"
register: registry_files
loop: "{{ res_reg_files }}"
when: res_reg_files is defined
delegate_to: "{{ undercloud_hostname }}"
vars:
ansible_python_interpreter: "{{ python_interpreter }}"
ansible_user: "stack"
- name: Copy files to undercloud if they do not exist
copy:
src: "{{ item.item| basename }}"
dest: "/home/stack/"
loop: "{{ registry_files.results }}"
when: (res_reg_files is defined) and (not item.stat.exists)
delegate_to: "{{ undercloud_hostname }}"
vars:
ansible_python_interpreter: "{{ python_interpreter }}"
ansible_user: "stack"
when: ( resource_registry is defined and resource_registry|length > 0)
- name: check neutron_backend defined
set_fact:
neutron_backend: "{{ (osp_release|int > 14) | ternary('ovn', 'ovs') }}"
when: neutron_backend is not defined
- name: set ovn facts
set_fact:
network_backend: 'geneve,vlan'
network_type: '--network-ovn'
when: neutron_backend == 'ovn'
- name: set ovs facts
set_fact:
network_backend: 'vxlan'
network_type: '--network-ovs'
when: neutron_backend == 'ovs'
- name: set extra template facts
set_fact:
oc_extra_templates: "--overcloud-templates none"
- block:
- name: copy extra.yml to .infrared dir, where infrared usually refers to for overcloud templates
copy:
src: "{{ ansible_user_dir }}/infrared/plugins/tripleo-overcloud/vars/overcloud/templates/extra.yml"
dest: "{{ ansible_user_dir }}/.infrared/plugins/tripleo-overcloud/vars/overcloud/templates/extra.yml"
delegate_to: localhost
- name: set extra template facts
set_fact:
oc_extra_templates: "--overcloud-templates docker-ceph-mds,manila-cephganesha,extra"
when: manila_enabled
- name: set extra template facts
set_fact:
oc_extra_templates: "--overcloud-templates extra"
when: not manila_enabled
when: ( extra_templates is defined and extra_templates|length>0 ) or ( parameter_defaults is defined and parameter_defaults.keys()|length>0 )
- name: set extra template facts
set_fact:
oc_extra_templates: "--overcloud-templates docker-ceph-mds,manila-cephganesha"
when: manila_enabled and not (( extra_templates is defined and extra_templates|length>0 ) or ( parameter_defaults is defined and parameter_defaults.keys()|length>0 ))
- name: set heat config facts
set_fact:
oc_heat_configs: "--config-heat {{ heat_configs | join(' --config-heat ') }}"
when: ( heat_configs is defined and heat_configs|length>0 )
# infrared is not using resource_registry passed through templates
# and forcing us to use --config-resource cli option
- name: set resource registry using infrared config resource
set_fact:
oc_config_resource: "--config-resource {{ resource_registry | join(' --config-resource ') }}"
when: ( resource_registry is defined and resource_registry|length>0 )
- name: prepare for nova-less provisioning
block:
- name: provisioning baremetal nodes
include_tasks: tasks/provisioning_baremetal_nodes.yml
when: novaless_prov
- block:
- name: set fact for osd-spec.yml file
set_fact:
osd_spec_file: "{{ ansible_user_dir }}/osd-spec.yml"
- name: generate osd-spec.yml.j2
template:
src: osd-spec.yml.j2
dest: "{{ osd_spec_file }}"
force: yes
- name: set facts for ceph deployment
set_fact:
ceph_params: "--storage-backend ceph --storage-external no --ceph-osd-spec-file {{ osd_spec_file }}"
when: ceph_enabled and osp_release|int >= 17
- name: set facts for ceph deployment
set_fact:
ceph_params: '--storage-backend ceph --storage-external no'
when: ceph_enabled and osp_release|int < 17
- name: set deployment_timeout to 2400
set_fact:
deployment_timeout: 2400
when: scale_compute_vms == true
- name: set fact for deployment with DVR
set_fact:
dvr_params: "--network-dvr yes"
when: dvr_enabled and osp_release|int >= 16
- name: run tripleo-overcloud deploy
shell: |
source .venv/bin/activate
infrared tripleo-overcloud -vvv --version {{ osp_release }} --deployment-timeout {{ deployment_timeout | default(240) }} --build {{ osp_puddle }} --deployment-files {{ nic_configs }} --introspect no --tagging no --deploy yes --controller-nodes {{ controller_count }} --compute-nodes {{ compute_count }} --storage-nodes {{ ceph_node_count }} --overcloud-image-name full {{ oc_extra_templates }} {{ dvr_params | default('') }} --network-protocol ipv4 --network-backend {{ network_backend }} {{ network_type }} true {{ ceph_params | default('') }} {{ storage_protocol_backend | default('') }} --ntp-server {{ gateway }} --public-network false {{ oc_heat_configs | default('') }} {{ oc_config_resource | default('') }} > {{ log_directory }}/overcloud_deploy.log 2>&1
args:
chdir: "{{ infrared_dir }}"