]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
facts: always set ceph_run_cmd and ceph_admin_command
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 14 May 2020 09:06:41 +0000 (11:06 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 15 May 2020 08:53:15 +0000 (10:53 +0200)
always set these facts on monitor nodes whatever we run with `--limit`.
Otherwise, playbook will fail when using `--limit` on nodes where these
facts are used on a delegated task to monitor.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-facts/tasks/facts.yml

index 42739d94e7a1db33f63bef837541cdf9686ff91d..39936582848edb399f8fa1df0f35b190f96637a0 100644 (file)
 - name: set_fact ceph_run_cmd
   set_fact:
     ceph_run_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else 'ceph' }}"
+  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 }}"
 
 - name: set_fact ceph_admin_command
   set_fact:
-    ceph_admin_command: "{{ ceph_run_cmd }} -n client.admin -k /etc/ceph/{{ cluster }}.client.admin.keyring"
\ No newline at end of file
+    ceph_admin_command: "{{ 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