From df4743566de29429aec06b318a4e6bcb0fd65eb6 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Sun, 18 Feb 2024 16:54:46 +0100 Subject: [PATCH] wip Signed-off-by: Seena Fallah --- roles/ceph-defaults/defaults/main.yml | 6 ++-- roles/ceph-mon/tasks/ceph_keys.yml | 49 +++++++++++++++++++-------- tox.ini | 2 +- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 28c68306df..c8cc1eb6d7 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -539,9 +539,9 @@ ceph_common_container_params: - --default-log-to-stderr=true - --default-log-stderr-prefix="debug " volumes: - - /var/lib/ceph/crash:/var/lib/ceph/crash:z - - /var/run/ceph:/var/run/ceph:z - - /var/log/ceph:/var/log/ceph:z + - /var/lib/ceph/crash:/var/lib/ceph/crash:z,rshared + - /var/run/ceph:/var/run/ceph:z,rshared + - /var/log/ceph:/var/log/ceph:z,rshared - /etc/ceph:/etc/ceph:z - /etc/localtime:/etc/localtime:ro diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index 02d002bcaf..387e957576 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -1,20 +1,39 @@ --- - name: Waiting for the monitor(s) to form the quorum... - ansible.builtin.command: > - {{ container_exec_cmd }} - ceph - --cluster {{ cluster }} - daemon mon.{{ ansible_facts['hostname'] }} - mon_status - --format json - register: ceph_health_raw - run_once: true - until: > - (ceph_health_raw.stdout | length > 0) and (ceph_health_raw.stdout | default('{}') | from_json)['state'] in ['leader', 'peon'] - retries: "{{ handler_health_mon_check_retries }}" - delay: "{{ handler_health_mon_check_delay }}" - changed_when: false - when: not ansible_check_mode + block: + - name: Wait for the monitor(s) to form the quorum + ansible.builtin.command: > + {{ container_exec_cmd }} + ceph + --cluster {{ cluster }} + daemon mon.{{ ansible_facts['hostname'] }} + mon_status + --format json + register: ceph_health_raw + run_once: true + until: > + (ceph_health_raw.stdout | length > 0) and (ceph_health_raw.stdout | default('{}') | from_json)['state'] in ['leader', 'peon'] + retries: "{{ handler_health_mon_check_retries }}" + delay: "{{ handler_health_mon_check_delay }}" + changed_when: false + when: not ansible_check_mode + rescue: + - name: List run dir + ansible.builtin.command: ls -lah /var/run/ceph + changed_when: false + - name: List run dir inside container + ansible.builtin.ocmmand: "{{ container_exec_cmd }} ls -lah /var/run/ceph" + changed_when: false + - name: Ceph status + ansible.builtin.command: > + {{ container_exec_cmd }} + ceph + --cluster {{ cluster }} + -s + changed_when: false + - name: Fail the task + ansible.builtin.fail: + msg: "Monitor(s) failed to form the quorum" - name: Fetch ceph initial keys ceph_key: diff --git a/tox.ini b/tox.ini index 5b6e8c794d..08bfeb18b7 100644 --- a/tox.ini +++ b/tox.ini @@ -360,7 +360,7 @@ commands= all_daemons,all_daemons_ipv6,collocation: py.test --reruns 20 --reruns-delay 3 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests # handlers/idempotency test - all_daemons,all_daemon_ipv6,all_in_one,collocation: ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "delegate_facts_host={env:DELEGATE_FACTS_HOST:True} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG_BIS:latest-bis-main} ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} yes_i_know=true" --extra-vars @ceph-override.json + all_daemons,all_daemon_ipv6,all_in_one,collocation: ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "no_log_on_ceph_key_tasks=false delegate_facts_host={env:DELEGATE_FACTS_HOST:True} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG_BIS:latest-bis-main} ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} yes_i_know=true" --extra-vars @ceph-override.json purge: {[purge]commands} purge_dashboard: {[purge-dashboard]commands}