]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
facts: fix broken facts when using --limit
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 13 Jul 2020 07:42:25 +0000 (09:42 +0200)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Tue, 21 Jul 2020 02:50:05 +0000 (22:50 -0400)
This commit fixes these tasks when --limit is used.

It makes sure the fact is set on right nodes even when the playbook is
run with `--limit`

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit f8a951f50c6a64ab3d60a1bf66ca9d2db2f6bc35)

roles/ceph-facts/tasks/facts.yml

index 066cdff08d5cb590fd38b0bbebb5f42f75820a3b..be40bc477556ce668c3803d9f06ece801957eff0 100644 (file)
   run_once: True
   with_items:
     - "{{ groups[mon_group_name] if groups[mon_group_name] | default([]) | length > 0 else [] }}"
-    - "{{ inventory_hostname }}"
+    - "{{ groups[mds_group_name] if groups[mds_group_name] | default([]) | length > 0 else [] }}"
+    - "{{ groups[client_group_name] if groups[client_group_name] | default([]) | length > 0 else [] }}"
 
 - name: set_fact ceph_admin_command
   set_fact:
-    ceph_admin_command: "{{ ceph_run_cmd }} -n client.admin -k /etc/ceph/{{ cluster }}.client.admin.keyring"
+    ceph_admin_command: "{{ hostvars[item]['ceph_run_cmd'] }} -n client.admin -k /etc/ceph/{{ cluster }}.client.admin.keyring"
   delegate_to: "{{ item }}"
   delegate_facts: True
   run_once: True
   with_items:
     - "{{ groups[mon_group_name] if groups[mon_group_name] | default([]) | length > 0 else [] }}"
-    - "{{ inventory_hostname }}"
+    - "{{ groups[mds_group_name] if groups[mds_group_name] | default([]) | length > 0 else [] }}"
+    - "{{ groups[client_group_name] if groups[client_group_name] | default([]) | length > 0 else [] }}"