-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yml
238 lines (212 loc) · 7.78 KB
/
deploy.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
- name: non-container hacks
hosts: undercloud
any_errors_fatal: true
tags:
- deploy_preparation
- deploy_environment
tasks:
- shell: |
#MODIFY THT_ROOT to point to your tripleo-heat-templates
THT_ROOT=/usr/share/openstack-tripleo-heat-templates/
cd $THT_ROOT/environments
> docker.yaml
> docker-ha.yaml
find . -exec sed -i -e "s|docker/services/collectd.yaml|puppet/services/metrics/collectd.yaml|g" {} \;
find . -exec sed -e "s|docker/services/sensu-client.yaml|puppet/services/monitoring/sensu-client.yaml|g" -i {} \;
find . -exec sed -e "s|docker/services|puppet/services|g" -i {} \;
when:
- install.containers|bool == false
- install.version|default(undercloud_version)|openstack_release >= 12
become: yes
- import_playbook: build_templates.yml
tags:
- deploy_preparation
- templates
- import_playbook: tls_everywhere.yml
tags:
- deploy_preparation
- templates
- freeipa
when:
- install.tls.everywhere|default(False)
- install.version|default(undercloud_version)|openstack_release >= 12
- (install.version|default(undercloud_version)|openstack_distribution) == 'OSP'
- name: Run heat agent script in a background if splitstack deployment
hosts: undercloud
gather_facts: no
any_errors_fatal: true
tags: deploy_preparation
tasks:
- name: Run heat agent script in a background if splitstack deployment
shell: ~{{ ansible_user|default(ansible_ssh_user) }}/heat-agent.sh > heat_agent.log 2>&1
async: 1000
poll: 0
when: install.splitstack|default(False)
- name: Deploy the Overcloud
hosts: undercloud
gather_facts: yes
any_errors_fatal: true
vars:
overcloudrc_file: "{{ ansible_user_dir }}/{{ install.overcloud.stack }}rc"
tags:
- deploy
tasks:
- block:
- name: adjust max number of concurrent builds to prevent undercloud overload
ini_file:
path: /etc/nova/nova.conf
section: DEFAULT
option: max_concurrent_builds
value: 5
become: yes
- name: restart nova services
command: "systemctl restart openstack-nova-*"
become: yes
when:
- install.version|openstack_release < 10
- name: Execute the pre overcloud deploy action
shell: |
{{ install.overcloud.predeploy.action }} &> pre_overcloud_install_action.log
register: pre_overcloud_install_action
ignore_errors: yes
when: install.get('overcloud', {}).get('predeploy', {}).get('action', {})
- name: Execute the overcloud deploy script
shell: |
source ~/stackrc
bash {{ overcloud_deploy_script }} &> overcloud_install.log
register: overcloud_deploy
ignore_errors: yes
- include_role:
name: tls-everywhere
vars:
stages:
- post_overcloud
when:
- install.tls.everywhere|default(False)
- install.version|default(undercloud_version)|openstack_release >= 12
- overcloud_deploy.rc == 0
- name: Print the last few lines of the output to spot failures
command: tail -n60 overcloud_install.log
# List of failures is supported since RHOS10
- name: Print stack failures
shell: |
source ~/stackrc
openstack stack failures list {{ install.overcloud.stack }}
when: overcloud_deploy.rc != 0 and install.version|default(undercloud_version)|openstack_release >= 10
tags: skip_ansible_lint
- name: Prepare stack failures long log
shell: |
source ~/stackrc
openstack stack failures list {{ install.overcloud.stack }} --long > openstack_failures_long.log
when: overcloud_deploy.rc != 0 and install.version|default(undercloud_version)|openstack_release >= 10
tags: skip_ansible_lint
- name: copy summary script
template:
src: deploy_info.sh.j2
dest: ~/deploy_info.sh
mode: 0755
tags: summary
- name: Prepare Execute the deployment summary script
become: yes
# TODO(yfried): use "file" module intead mkdir
shell: |
mkdir -p /var/log/extra/
source ~{{ ansible_user|default(ansible_ssh_user) }}/stackrc
~{{ ansible_user|default(ansible_ssh_user) }}/deploy_info.sh --long > /var/log/extra/deploy_resources.log 2>&1 &
~{{ ansible_user|default(ansible_ssh_user) }}/deploy_info.sh 2>&1 &
wait
tags: summary
- name: Update inventory with overcloud details
import_playbook: update_inventory.yml
tags:
- inventory_update
- deploy
- name: Verify overcloud deployment
hosts: undercloud
gather_facts: no
any_errors_fatal: true
vars:
overcloudrc_file: "{{ ansible_user_dir }}/{{ install.overcloud.stack }}rc"
tags:
- deploy
tasks:
- fail:
msg: "Overcloud deployment failed... :("
when: overcloud_deploy is defined and overcloud_deploy.rc != 0
- name: verify overcloudrc was created
wait_for:
path: "{{ overcloudrc_file }}"
state: present
timeout: 60
- name: check if we have v3 rc file
stat:
path: "{{ ansible_user_dir }}/{{ install.overcloud.stack }}rc.v3"
register: rc_file_path
tags:
- clouds_file
- name: update clouds.yaml file
include_tasks: clouds.yml
vars:
v3_file: "{{ install.overcloud.stack }}rc.v3"
v2_file: "{{ install.overcloud.stack }}rc"
auth_file_path: "{{ ansible_user_dir }}/{{ rc_file_path.stat.exists | ternary(v3_file, v2_file) }}"
cloudname: "{{ (auth_file_path|basename == 'stackrc') |ternary('undercloud','overcloud') }}"
tags:
- clouds_file
- name: fetch the overcloud rc file
tags:
- fetch_rc_file
fetch:
src: "{{ overcloudrc_file }}"
dest: "{{ inventory_dir }}/keystonerc"
flat: yes
fail_on_missing: yes
- name: fetch overcloud v3 file if present
tags:
- fetch_rc_file
fetch:
src: "{{ ansible_user_dir }}/{{ install.overcloud.stack }}rc.v3"
dest: "{{ inventory_dir }}/{{ install.overcloud.stack }}rc.v3"
flat: yes
fail_on_missing: no
- name: Read baremetal nodes got from user input on hybrid deployment
block:
- name: Set hybrid var
include_vars:
file: "{{ install.hybrid }}"
name: bm_nodes
- name: get nodes name
set_fact:
node_name: "{{ item.name }}"
with_items: "{{ bm_nodes.nodes }}"
register: nodes
- name: set list of bm nodes
set_fact:
bm_nodes: "{{ nodes.results | map(attribute='ansible_facts.node_name') | list }}"
when: install.hybrid is defined
- name: set bm_nodes to empty when not hybrid
set_fact:
bm_nodes: ""
when: install.hybrid is not defined
- name: Get overcloud nodes
set_fact:
oc_nodes: "{{ groups.get('overcloud_nodes', []) }}"
- name: Allow vbmc ports for all the overcloud nodes
hosts: localhost
gather_facts: no
any_errors_fatal: true
tags:
- deploy
- vbmc_post
vars_files:
- "{{ install.public.subnet }}"
tasks:
- name: setup vbmc access for all the available overcloud nodes
include_role:
name: vbmc
tasks_from: iptables_overcloud.yml
when:
- "'hypervisor' in groups"
- install.version|default(undercloud_version) | openstack_release >= 11 or install.vbmc.force
- subnet is defined
- subnet.cidr is defined