From: Guillaume Abrioux Date: Tue, 7 Apr 2020 09:16:25 +0000 (+0200) Subject: add-osd: unset noup flag after last osd is deployed X-Git-Tag: v3.2.41~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8ccf91c1f0f693f2e1b3d7bc0ea1e4e7e8787311;p=ceph-ansible.git add-osd: unset noup flag after last osd is deployed this commit fixes a bug when using `add-osd.yml` playbook. `noup` flag is set early but it never got unset before the "wait for pgs clean" check, so the playbook always fails because OSDs aren't never seen UP. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1816023 Signed-off-by: Guillaume Abrioux --- diff --git a/roles/ceph-handler/handlers/main.yml b/roles/ceph-handler/handlers/main.yml index 17c44b682..3e2fd037f 100644 --- a/roles/ceph-handler/handlers/main.yml +++ b/roles/ceph-handler/handlers/main.yml @@ -5,6 +5,11 @@ when: - ansible_os_family == 'Debian' +- name: unset noup flag + command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup" + delegate_to: "{{ groups[mon_group_name][0] }}" + changed_when: False + # We only want to restart on hosts that have called the handler. # This var is set when he handler is called, and unset after the # restart to ensure only the correct hosts are restarted. diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index d202a2d64..961ae006f 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -35,6 +35,13 @@ - name: include_tasks common.yml include_tasks: common.yml +- name: set noup flag + command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd set noup" + delegate_to: "{{ groups[mon_group_name][0] }}" + run_once: True + changed_when: False + when: not rolling_update | default(False) | bool + - name: include ceph_disk_cli_options_facts.yml include_tasks: ceph_disk_cli_options_facts.yml @@ -89,6 +96,14 @@ - name: include_tasks start_osds.yml include_tasks: start_osds.yml +- name: unset noup flag + command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup" + delegate_to: "{{ groups[mon_group_name][0] }}" + changed_when: False + when: + - not rolling_update | default(False) | bool + - inventory_hostname == ansible_play_hosts_all | last + - name: wait for all osd to be up command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} -s -f json" register: wait_for_all_osds_up @@ -100,6 +115,8 @@ until: - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_osds"] | int > 0 - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_up_osds"] + when: + - inventory_hostname == ansible_play_hosts_all | last - name: include crush_rules.yml include_tasks: crush_rules.yml