]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
client: keyrings aren't created when single client node
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 8 Jun 2018 06:49:37 +0000 (08:49 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 8 Jun 2018 13:05:47 +0000 (15:05 +0200)
combining `run_once: true` with `inventory_hostname ==
groups.get(client_group_name) | first` might cause bug when the only
node being run is not the first in the group.

In a deployment with a single client node it might cause issue because
sometimes keyring won't be created since the task could be definitively
skipped.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1588093
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-client/tasks/create_users_keys.yml

index a0d10ce70f8d334bbbb30bbac7851f3ef17ebf03..b468c13d12c37fc1dab97650d5845934467ee4af 100644 (file)
@@ -23,8 +23,9 @@
     {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
     300
   changed_when: false
-  run_once: true
-  when: containerized_deployment
+  when:
+    - containerized_deployment
+    - inventory_hostname == groups.get(client_group_name) | first
 
 - name: set_fact delegated_node
   set_fact:
     import_key: "{{ copy_admin_key }}"
     mode: "{{ item.mode|default(omit) }}"
   with_items: "{{ keys }}"
-  run_once: true
   delegate_to: "{{ delegated_node }}"
   when:
     - cephx
     - keys | length > 0
-    - inventory_hostname in groups.get(client_group_name) | first
+    - inventory_hostname == groups.get(client_group_name) | first
 
 - name: slurp client cephx key(s)
   slurp:
   with_items:
     - "{{ keys }}"
   register: slurp_client_keys
-  run_once: true
   delegate_to: "{{ delegated_node }}"
   when:
     - cephx
     - keys | length > 0
-    - inventory_hostname in groups.get(client_group_name) | first
+    - inventory_hostname == groups.get(client_group_name) | first
 
 - name: list existing pool(s)
   command: >
     osd pool get {{ item.name }} size
   with_items: "{{ pools }}"
   register: created_pools
-  run_once: true
   failed_when: false
   delegate_to: "{{ delegated_node }}"
   when:
     - condition_copy_admin_key
+    - inventory_hostname == groups.get(client_group_name, []) | first
 
 - name: create ceph pool(s)
   command: >
     - "{{ pools }}"
     - "{{ created_pools.results }}"
   changed_when: false
-  run_once: true
   delegate_to: "{{ delegated_node }}"
   when:
     - pools | length > 0
     owner: "{{ ceph_uid }}"
     group: "{{ ceph_uid }}"
   with_items:
-    - "{{ slurp_client_keys.results }}"
+    - "{{ hostvars[groups[client_group_name][0]]['slurp_client_keys']['results'] }}"
   when:
     - not item.get('skipped', False)
-    - not inventory_hostname == groups.get(client_group_name, []) | first