]> git.apps.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>
Mon, 20 Jul 2020 14:56:10 +0000 (10:56 -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>
roles/ceph-facts/tasks/facts.yml

index 0a3d971ea68c2a96ba4fb1cc223a2c652e8ebea3..6af5e3e9082ba30d5bd77c29a1dd0b39dcfa8be0 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 }}"
\ No newline at end of file
+    - "{{ 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 [] }}"
\ No newline at end of file