]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-facts: fix _container_exec_cmd fact value v4.0.14
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 29 Jan 2020 02:34:24 +0000 (21:34 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 29 Jan 2020 10:48:44 +0000 (11:48 +0100)
When using different name between the inventory_hostname and the
ansible_hostname then the _container_exec_cmd fact will get a wrong
value based on the inventory_hostname instead of the ansible_hostname.
This happens when the ceph cluster is already running (update/upgrade).

Later the container exec commands will fail because the container name
is wrong.

We should always set the _container_exec_cmd based on the
ansible_hostname fact.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1795792
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 1fcafffdad43476d1d99766a57b4087cfe43718b)

roles/ceph-facts/tasks/facts.yml

index 152414d026033ea7edaf8a49eee79c12cfc763e3..8d27812bb40b9587ff57d72f9a2dcf42e8531004 100644 (file)
 
     - name: set_fact _container_exec_cmd
       set_fact:
-        _container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] if running_mon is undefined else running_mon }}"
+        _container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0] if running_mon is undefined else running_mon]['ansible_hostname'] }}"
       when:
         - containerized_deployment | bool