-
Notifications
You must be signed in to change notification settings - Fork 551
/
do_reconfigure.yml
214 lines (193 loc) · 6.56 KB
/
do_reconfigure.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
---
- name: Ensuring the ceph_mon container is up
kolla_docker:
name: "{{ item.name }}"
action: "get_container_state"
register: ceph_mon_container_state
failed_when: container_state.Running == false
when: inventory_hostname in groups[item.group]
with_items:
- { name: ceph_mon, group: ceph-mon }
- name: Looking up OSDs for Ceph
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
-m find_disks
-a "partition_name='KOLLA_CEPH_DATA' match_mode='prefix'"
register: osd_lookup
changed_when: "{{ osd_lookup.stdout.find('localhost | SUCCESS => ') != -1 and (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: osd_lookup.stdout.split()[2] != 'SUCCESS'
when: inventory_hostname in groups['ceph-osd']
- name: Reading data from variable
set_fact:
osds: "{{ (osd_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}"
when: inventory_hostname in groups['ceph-osd']
- name: Gathering OSD IDs
command: "cat /var/lib/ceph/osd/{{ item['fs_uuid'] }}/whoami"
with_items: osds
register: osd_ids
changed_when: False
failed_when: osd_ids.rc != 0
when: inventory_hostname in groups['ceph-osd']
- name: Ensuring the ceph_osd container is up
kolla_docker:
name: "ceph_osd_{{ item.stdout }}"
action: "get_container_state"
register: ceph_osd_container_state
failed_when: ceph_osd_container_state.Running == false
when: inventory_hostname in groups['ceph-osd']
with_items: osd_ids.results
- name: Ensuring the ceph_rgw container is up
kolla_docker:
name: "{{ item.name }}"
action: "get_container_state"
register: ceph_rgw_container_state
failed_when: container_state.Running == false
when:
- enable_ceph_rgw | bool
- inventory_hostname in groups[item.group]
with_items:
- { name: ceph_rgw, group: ceph-rgw }
- include: config.yml
- name: Check the configs in ceph_mon container
command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
register: ceph_mon_check_results
when: inventory_hostname in groups[item.group]
with_items:
- { name: ceph_mon, group: ceph-mon }
- name: Check the configs in the ceph_osd container
command: docker exec ceph_osd_{{ item.stdout }} /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
register: ceph_osd_check_results
with_items: osd_ids.results
when: inventory_hostname in groups['ceph-osd']
- name: Check the configs in ceph_rgw container
command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
register: ceph_rgw_check_results
when:
- inventory_hostname in groups[item.group]
- enable_ceph_rgw | bool
with_items:
- { name: ceph_rgw, group: ceph-rgw}
- name: Containers config strategy for ceph_mon container
kolla_docker:
name: "{{ item.name }}"
action: "get_container_env"
register: ceph_mon_container_envs
when: inventory_hostname in groups[item.group]
with_items:
- { name: ceph_mon, group: ceph-mon }
- name: Containers config strategy for the ceph_osd containers
kolla_docker:
name: "ceph_osd_{{ item.stdout }}"
action: "get_container_env"
register: ceph_osd_container_envs
with_items: osd_ids.results
when:
- inventory_hostname in groups['ceph-osd']
- osds
- name: Containers config strategy for ceph_rgw container
kolla_docker:
name: "{{ item.name }}"
action: "get_container_env"
register: ceph_rgw_container_envs
when:
- inventory_hostname in groups[item.group]
- enable_ceph_rgw | bool
with_items:
- { name: ceph_rgw, group: ceph-rgw }
- name: Remove the ceph_mon container
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "remove_container"
register: remove_ceph_mon_container
when:
- inventory_hostname in groups[item[0]['group']]
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[2]['rc'] == 1
with_together:
- [{ name: ceph_mon, group: ceph-mon }]
- ceph_mon_container_envs.results
- ceph_mon_check_results.results
- name: Remove the ceph_osd containers
kolla_docker:
name: "ceph_osd_{{ item.0.stdout }}"
action: "remove_container"
register: remove_ceph_osd_containers
when:
- inventory_hostname in groups['ceph-osd']
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[2]['rc'] == 1
- osds
with_together:
- osd_ids.results
- ceph_osd_container_envs.results
- ceph_osd_check_results.results
- name: Remove the ceph_rgw container
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "remove_container"
register: remove_ceph_rgw_container
when:
- enable_ceph_rgw | bool
- inventory_hostname in groups[item[0]['group']]
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[2]['rc'] == 1
with_together:
- [{ name: ceph_rgw, group: ceph-rgw }]
- ceph_rgw_container_envs.results
- ceph_rgw_check_results.results
- include: start_mons.yml
when:
- inventory_hostname in groups['ceph-mon']
- remove_ceph_mon_container.changed
- include: start_osds.yml
when:
- inventory_hostname in groups['ceph-osd']
- remove_ceph_osd_containers.changed
- include: start_rgws.yml
when:
- inventory_hostname in groups['ceph-rgw']
- remove_ceph_rgw_container.changed
- name: Restart the ceph_mon container
kolla_docker:
name: "ceph_mon"
action: "restart_container"
when:
- inventory_hostname in groups['ceph-mon']
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
with_together:
- ceph_mon_container_envs.results
- ceph_mon_check_results.results
- name: Restart the ceph_osd container
kolla_docker:
name: "ceph_osd_{{ item.0.stdout }}"
action: "restart_container"
when:
- inventory_hostname in groups['ceph-osd']
- config_strategy == 'COPY_ALWAYS'
- item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[2]['rc'] == 1
- osds
with_together:
- osd_ids.results
- ceph_osd_container_envs.results
- ceph_osd_check_results.results
- name: Restart the ceph_rgw container
kolla_docker:
name: "ceph_rgw"
action: "restart_container"
when:
- enable_ceph_rgw | bool
- inventory_hostname in groups['ceph-rgw']
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
with_together:
- ceph_rgw_container_envs.results
- ceph_rgw_check_results.results