forked from redhat-performance/jetpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathovercloud.yml
299 lines (261 loc) · 12.6 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
---
- 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 > 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 }}"
- name: generate firstboot-nvme.yaml
template:
src: "firstboot-nvme.yaml.j2"
dest: "/home/stack/firstboot-nvme.yaml"
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)
- hosts: localhost
gather_facts: yes
tasks:
- name: Set compute count fact
set_fact:
compute_count: "{{ compute_count|default(oc_instackenv_content.nodes|length - (controller_count|int) - (ceph_node_count|int)) }}"
- name: get nodes
shell: |
source ~/stackrc
openstack baremetal node list -f value -c UUID
register: nodes_uuids
changed_when: false
delegate_to: "{{ groups.undercloud|first }}"
vars:
ansible_python_interpreter: "{{ python_interpreter }}"
ansible_user: "stack"
- block:
- name: check registered nodes with requested node count
debug:
msg: "Less nodes {{ nodes_uuids.stdout_lines|length }} registered with ironic than requested {{ compute_count|int + controller_count|int + ceph_node_count|int }}. So we will be adjusting controller and compute count according to registered available nodes"
when: nodes_uuids.stdout_lines|length < (compute_count|int + controller_count|int + ceph_node_count|int)
- name: Adjust compute count
set_fact:
compute_count: "{{ compute_count|int - 1 }}"
when: nodes_uuids.stdout_lines|length < (compute_count|int + controller_count|int + ceph_node_count|int)
with_items: "{{ nodes_uuids }}"
when: scale_compute_vms == false
- name: fail when compute count is less than 1
fail:
msg: "Failing as compute count is less than 1"
when: compute_count|int < 1
- name: set facts about failed nodes
set_fact:
failed_nodes_machine_type: "{{ hostvars['undercloud']['failed_nodes_machine_type'] }}"
failed_nodes_machine_count: "{{ hostvars['undercloud']['failed_nodes_machine_count'] }}"
when: composable_roles
ignore_errors: true
- name: Template out nodes_data file
template:
src: nodes_data.yml.j2
dest: ~/virt/nodes_data.yaml
when: composable_roles
- 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 resource_registry nvme parameters
vars:
res_reg: "{{ resource_registry|default([]) }}"
set_fact:
resource_registry: "{{ res_reg + ['OS::TripleO::NodeUserData=/home/stack/firstboot-nvme.yaml'] }}"
when: passthrough_nvme is defined or mount_nvme is defined
- 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: (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"
- name: set extra template facts
set_fact:
oc_extra_templates: "--overcloud-templates {{ infrared_dir }}/plugins/tripleo-overcloud/vars/overcloud/templates/extra.yml"
when: ( 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
- name: set fact for storage nodes
set_fact:
storage_node_disks: "{{ hostvars['undercloud']['storage_node_disks']|unique }}"
when: ceph_enabled and storage_node_disks is not defined
- name: generate internal.yml.j2
template:
src: internal.yml.j2
dest: ~/.infrared/plugins/tripleo-overcloud/templates/storage/internal.yml.j2
force: yes
when: ceph_enabled
- name: set facts for ceph deployment
set_fact:
ceph_params: "--storage-backend ceph --storage-external no"
when: ceph_enabled
- 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 }} {{ oc_extra_templates }} --network-protocol ipv4 --network-backend {{ network_backend }} {{ network_type }} true {{ ceph_params | default('') }} --public-network false {{ oc_heat_configs | default('') }} {{ oc_config_resource | default('') }} > {{ log_directory }}/overcloud_deploy.log 2>&1
args:
chdir: "{{ infrared_dir }}"