mirror of https://github.com/ceph/ceph-ansible.git
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
parent
f7c6f4e0b6
commit
8add55451c
|
@ -83,7 +83,8 @@
|
||||||
become: True
|
become: True
|
||||||
tasks:
|
tasks:
|
||||||
- name: set mon_host_count
|
- 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
|
- name: fail when less than three monitors
|
||||||
fail:
|
fail:
|
||||||
|
@ -91,6 +92,10 @@
|
||||||
when:
|
when:
|
||||||
- mon_host_count | int < 3
|
- 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
|
- name: stop ceph mon - shortname
|
||||||
systemd:
|
systemd:
|
||||||
name: ceph-mon@{{ ansible_hostname }}
|
name: ceph-mon@{{ ansible_hostname }}
|
||||||
|
@ -138,6 +143,27 @@
|
||||||
name: ceph-mgr
|
name: ceph-mgr
|
||||||
when: groups.get(mgr_group_name, []) | length == 0
|
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
|
- name: start ceph mon
|
||||||
systemd:
|
systemd:
|
||||||
name: ceph-mon@{{ monitor_name }}
|
name: ceph-mon@{{ monitor_name }}
|
||||||
|
@ -174,13 +200,6 @@
|
||||||
when:
|
when:
|
||||||
- containerized_deployment
|
- 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...
|
- 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
|
||||||
register: ceph_health_raw
|
register: ceph_health_raw
|
||||||
|
@ -222,22 +241,6 @@
|
||||||
- ['bootstrap-rbd', 'bootstrap-rbd-mirror']
|
- ['bootstrap-rbd', 'bootstrap-rbd-mirror']
|
||||||
- "{{ groups[mon_group_name] | difference([mon_host]) }}" # so the key goes on all the nodes
|
- "{{ 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
|
- name: upgrade ceph mgr node
|
||||||
|
|
Loading…
Reference in New Issue