From 3891d722b84d10643f2dfcc375977791642d6b74 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 4 Apr 2022 15:09:51 +0200 Subject: [PATCH] facts: always set `docker_exec_cmd` This ensures `docker_exec_cmd` is always set on the first monitor. Otherwise, when running the playbook with `--limit`, it fails on tasks calling `docker_exec_cmd` with a delegate_to on the first monitor since it was not set. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2071676 Signed-off-by: Guillaume Abrioux --- roles/ceph-facts/tasks/facts.yml | 2 ++ roles/ceph-osd/tasks/main.yml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index 0cb638b2f..8c367ba8f 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -24,6 +24,8 @@ set_fact: docker_exec_cmd: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}" delegate_to: "{{ groups[mon_group_name][0] }}" + delegate_facts: true + run_once: true when: - containerized_deployment - groups.get(mon_group_name, []) | length > 0 diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 99fadec16..9c0ee6716 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -36,7 +36,7 @@ include_tasks: common.yml - name: set noup flag - command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd set noup" + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd set noup" delegate_to: "{{ groups[mon_group_name][0] }}" run_once: True changed_when: False @@ -99,7 +99,7 @@ include_tasks: start_osds.yml - name: unset noup flag - command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup" + command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd unset noup" delegate_to: "{{ groups[mon_group_name][0] }}" changed_when: False when: -- 2.47.3