update: set osd flags only once

There is no need to set osd flags (noout, norebalance) each time we
upgrade a mon.

This commit moves up those tasks (before stopping the mon) so we don't need
to delegate them.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/3748/head
Guillaume Abrioux 2019-03-20 09:46:21 +01:00 committed by Dimitri Savineau
parent f7c6f4e0b6
commit 8add55451c
1 changed files with 27 additions and 24 deletions

View File

@ -83,7 +83,8 @@
become: True
tasks:
- name: set mon_host_count
set_fact: mon_host_count={{ groups[mon_group_name] | length }}
set_fact:
mon_host_count: "{{ groups[mon_group_name] | length }}"
- name: fail when less than three monitors
fail:
@ -91,6 +92,10 @@
when:
- mon_host_count | int < 3
- name: select a running monitor
set_fact:
mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last }}"
- name: stop ceph mon - shortname
systemd:
name: ceph-mon@{{ ansible_hostname }}
@ -138,6 +143,27 @@
name: ceph-mgr
when: groups.get(mgr_group_name, []) | length == 0
- name: set osd flags
command: ceph --cluster {{ cluster }} osd set {{ item }}
with_items:
- noout
- norebalance
delegate_to: "{{ mon_host }}"
when:
- inventory_hostname == groups[mon_group_name][0]
- not containerized_deployment
- name: set containerized osd flags
command: >
{{ container_binary }} exec ceph-mon-{{ hostvars[mon_host]['ansible_hostname'] }} ceph --cluster {{ cluster }} osd set {{ item }}
with_items:
- noout
- norebalance
delegate_to: "{{ mon_host }}"
when:
- inventory_hostname == groups[mon_group_name][0]
- containerized_deployment
- name: start ceph mon
systemd:
name: ceph-mon@{{ monitor_name }}
@ -174,13 +200,6 @@
when:
- containerized_deployment
- name: set mon_host_count
set_fact: mon_host_count={{ groups[mon_group_name] | length }}
- name: select a running monitor
set_fact:
mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last }}"
- name: non container | waiting for the monitor to join the quorum...
command: ceph --cluster "{{ cluster }}" -s --format json
register: ceph_health_raw
@ -222,22 +241,6 @@
- ['bootstrap-rbd', 'bootstrap-rbd-mirror']
- "{{ groups[mon_group_name] | difference([mon_host]) }}" # so the key goes on all the nodes
- name: set osd flags
command: ceph --cluster {{ cluster }} osd set {{ item }}
with_items:
- noout
- norebalance
delegate_to: "{{ mon_host }}"
when: not containerized_deployment
- name: set containerized osd flags
command: >
{{ container_binary }} exec ceph-mon-{{ hostvars[mon_host]['ansible_hostname'] }} ceph --cluster {{ cluster }} osd set {{ item }}
with_items:
- noout
- norebalance
delegate_to: "{{ mon_host }}"
when: containerized_deployment
- name: upgrade ceph mgr node