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