]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-client: use group_by instead of add_host
authorDimitri Savineau <dsavinea@redhat.com>
Mon, 30 Nov 2020 17:15:48 +0000 (12:15 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 1 Dec 2020 09:58:48 +0000 (10:58 +0100)
Instead of iterate over all client nodes with a loop sequentially, we
can use the group_by ansible buildin.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
roles/ceph-client/tasks/create_users_keys.yml

index e6c53a01e4d2e4b17a4f85ba0a8f06c0ebfd7214..b6cdf6c27cd974a13649caa4d413c74bdb785bc1 100644 (file)
@@ -5,11 +5,10 @@
 # when running with containerized_deployment: false this task
 # will add all client hosts to the group (and not filter).
 - name: create filtered clients group
-  add_host:
-    name: "{{ item }}"
-    groups: _filtered_clients
-  with_items: "{{ groups[client_group_name] | intersect(ansible_play_batch) }}"
-  when: (hostvars[item]['ansible_architecture'] == 'x86_64') or (not containerized_deployment | bool)
+  group_by:
+    key: _filtered_clients
+    parents: "{{ client_group_name }}"
+  when: (ansible_architecture == 'x86_64') or (not containerized_deployment | bool)
 
 - name: set_fact delegated_node
   set_fact: