mirror of https://github.com/ceph/ceph-ansible.git
rolling_update: refact set_fact `mon_host`
each monitor node should select another monitor which isn't itself.
Otherwise, one node in the monitor group won't set this fact and causes
failure.
Typical error:
```
TASK [create potentially missing keys (rbd and rbd-mirror) when mon is containerized] ***
task path: /home/jenkins-build/build/workspace/ceph-ansible-prs-dev-update_docker_cluster/rolling_update.yml:200
Thursday 22 November 2018 14:02:30 +0000 (0:00:07.493) 0:02:50.005 *****
fatal: [mon1]: FAILED! => {}
MSG:
The task includes an option with an undefined variable. The error was: 'dict object' has no attribute u'mon2'
```
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit af78173584
)
pull/3384/head
parent
d4f1f12bd0
commit
1f4cf61058
|
@ -153,17 +153,8 @@
|
||||||
set_fact: mon_host_count={{ groups[mon_group_name] | length }}
|
set_fact: mon_host_count={{ groups[mon_group_name] | length }}
|
||||||
|
|
||||||
- name: select a running monitor if multiple monitors
|
- name: select a running monitor if multiple monitors
|
||||||
set_fact: mon_host={{ item }}
|
set_fact:
|
||||||
with_items: "{{ groups[mon_group_name] }}"
|
mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last if mon_host_count > 1 else groups[mon_group_name] | last }}"
|
||||||
when:
|
|
||||||
- mon_host_count | int > 1
|
|
||||||
- item != inventory_hostname
|
|
||||||
|
|
||||||
- name: select first monitor if only one monitor
|
|
||||||
set_fact: mon_host={{ item }}
|
|
||||||
with_items: "{{ groups[mon_group_name][0] }}"
|
|
||||||
when:
|
|
||||||
- mon_host_count | int == 1
|
|
||||||
|
|
||||||
- name: non container | waiting for the monitor to join the quorum...
|
- name: non container | waiting for the monitor to join the quorum...
|
||||||
command: ceph --cluster "{{ cluster }}" -s --format json
|
command: ceph --cluster "{{ cluster }}" -s --format json
|
||||||
|
|
Loading…
Reference in New Issue