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 <gabrioux@redhat.com>
stable-3.2 v3.2.59
Guillaume Abrioux 2022-04-04 15:09:51 +02:00
parent ff4c31be85
commit 3891d722b8
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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: