]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
osd: fix monitor_name error when scaling out OSDs
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 9 Apr 2020 12:48:53 +0000 (14:48 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 10 Apr 2020 11:44:15 +0000 (13:44 +0200)
This commit fixes a bug when trying to scale out osd nodes with
`crush_rule_config` is enabled.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1822599
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 4bcc52cb2aad9bac563025ba4fd9ae4565524b67)

roles/ceph-facts/tasks/facts.yml

index b20a768dc6a7950b38c6a3058d8e43beaf1271c5..216e09b312beb4c2e44144e6fc24050671d3b917 100644 (file)
 
 - name: set_fact monitor_name ansible_hostname
   set_fact:
-    monitor_name: "{{ ansible_hostname }}"
-  when: not mon_use_fqdn | bool
+    monitor_name: "{{ hostvars[item]['ansible_hostname'] }}"
+  delegate_to: "{{ item }}"
+  delegate_facts: true
+  with_items: "{{ groups.get(mon_group_name, []) }}"
+  run_once: true
+  when:
+    - groups.get(mon_group_name, []) | length > 0
+    - not mon_use_fqdn | bool
 
 - name: set_fact monitor_name ansible_fqdn
   set_fact:
-    monitor_name: "{{ ansible_fqdn }}"
-  when: mon_use_fqdn | bool
+    monitor_name: "{{ hostvars[item]['ansible_fqdn'] }}"
+  delegate_to: "{{ item }}"
+  delegate_facts: true
+  with_items: "{{ groups.get(mon_group_name, []) }}"
+  run_once: true
+  when:
+    - groups.get(mon_group_name, []) | length > 0
+    - mon_use_fqdn | bool
 
 - name: find a running monitor
   when: groups.get(mon_group_name, []) | length > 0