]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
mon: fix with_items being evaluated before when 1567/head
authorSébastien Han <seb@redhat.com>
Tue, 11 Apr 2017 10:10:55 +0000 (12:10 +0200)
committerSébastien Han <seb@redhat.com>
Wed, 24 May 2017 14:31:33 +0000 (16:31 +0200)
Ansible evaluates the 'with_items' before the 'when' so if the inventory
does not have the group declared it'll fail. To fix this, we set an
empty array to make the with_items happy and then evaluate with the
'when'.

Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit 05331a26348e162e4083131d2a259f6c983f3ec9)
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-mon/tasks/docker/fetch_configs.yml

index 5b8df68ff4ca5e69c556fa67daba29c33832a10e..a96f34c8873064a79f02b6faf4bf4b6242acbe16 100644 (file)
@@ -13,7 +13,7 @@
 - name: add mgr keys to config and keys paths
   set_fact:
     tmp_ceph_mgr_keys: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring
-  with_items: "{{ groups[mgr_group_name] }}"
+  with_items: "{{ groups.get(mgr_group_name, []) }}"
   register: tmp_ceph_mgr_keys_result
   when: "{{ groups.get(mgr_group_name, []) | length > 0 }}"