update: skip mds deactivation when no mds in inventory

Let's skip this part of the code if there's no mds node in the
inventory.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 5ec906c3af)
pull/4683/head v3.2.34
Guillaume Abrioux 2019-10-23 15:48:32 +02:00 committed by Dimitri Savineau
parent f3fc97caa0
commit 4b667b2f37
1 changed files with 81 additions and 76 deletions

View File

@ -465,10 +465,14 @@
hosts: "{{ groups[mon_group_name|default('mons')][0] }}"
become: true
roles:
- ceph-defaults
- ceph-facts
- role: ceph-defaults
- role: ceph-facts
when: groups.get(mds_group_name, []) | length > 1
post_tasks:
- name: deactivate all mds rank > 0
when: groups.get(mds_group_name, []) | length > 1
block:
- name: get mds cluster status
command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} fs get {{ cephfs }} -f json"
changed_when: false
@ -511,12 +515,6 @@
mds_active_name: "{{ (_mds_active_name.stdout | from_json)['info'][item.key]['name'] }}"
with_dict: "{{ (_mds_active_name.stdout | from_json).info }}"
- name: create active_mdss group
add_host:
name: "{{ mds_active_name }}"
groups: active_mdss
ansible_host: "{{ hostvars[mds_active_name]['ansible_host'] | default(omit) }}"
ansible_port: "{{ hostvars[mds_active_name]['ansible_port'] | default(omit) }}"
- name: create standby_mdss group
add_host:
@ -553,11 +551,18 @@
delay: 5
until: (wait_standbys_down.stdout | from_json).standbys | length == 0
- name: create active_mdss group
add_host:
name: "{{ mds_active_name if mds_active_name is defined else groups.get(mds_group_name)[0] }}"
groups: active_mdss
ansible_host: "{{ hostvars[mds_active_name if mds_active_name is defined else groups.get(mds_group_name)[0]]['ansible_host'] | default(omit) }}"
ansible_port: "{{ hostvars[mds_active_name if mds_active_name is defined else groups.get(mds_group_name)[0]]['ansible_port'] | default(omit) }}"
- name: upgrade active mds
vars:
upgrade_ceph_packages: True
hosts: active_mdss
hosts: active_mdss | default([])
become: true
pre_tasks:
- name: prevent restart from the packaging