From 8add55451c25d09009cbd0618ed27e9937ea62df Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 20 Mar 2019 09:46:21 +0100 Subject: [PATCH] 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 --- infrastructure-playbooks/rolling_update.yml | 51 +++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 75861b348..15eee8f6e 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -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 -- 2.39.5