]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
clients: build filtered clients group early
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 16 Mar 2021 13:51:06 +0000 (14:51 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 25 Mar 2021 23:05:33 +0000 (00:05 +0100)
when the group `_filtered_clients` is built, the order can change from
the original `clients` group which can cause issues since we run
`ceph-container-engine` on the first client only. It means later in the
playbook we can make call to the container CLI on a node where the
container engine wasn't installed.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit a1125727345b55b9e0e6898dd58f3ea009e0eccd)

roles/ceph-client/tasks/create_users_keys.yml
site-container.yml.sample
site.yml.sample

index a21345c53a3fef0d59168726e584fa311527123c..4ea7f55cd5c8cca70492b4a11dbdd33dc6027a1f 100644 (file)
@@ -1,16 +1,4 @@
 ---
-# dummy container setup is only supported on x86_64
-# when running with containerized_deployment: true this task
-# creates a group that contains only x86_64 hosts.
-# 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_facts']['ansible_architecture'] == 'x86_64') or (not containerized_deployment | bool)
-
 - name: set_fact delegated_node
   set_fact:
     delegated_node: "{{ groups[mon_group_name][0] if groups.get(mon_group_name, []) | length > 0 else inventory_hostname }}"
index a3e97d404f3f79c2a45d95b809d60d96a16c6933..5e9cd82b2daeda2b0f122e82f4b0cf8964a82ecc 100644 (file)
 
     - import_role:
         name: ceph-defaults
+
+    # dummy container setup is only supported on x86_64
+    # when running with containerized_deployment: true this task
+    # creates a group that contains only x86_64 hosts.
+    # 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.get(client_group_name, []) | intersect(ansible_play_batch) }}"
+      when: (hostvars[item]['ansible_facts']['architecture'] == 'x86_64') or (not containerized_deployment | bool)
+
       tags: [with_pkg, fetch_container_image]
     - import_role:
         name: ceph-facts
     - import_role:
         name: ceph-container-engine
       tags: with_pkg
-      when: (group_names != ['clients']) or (inventory_hostname == groups.get('clients', [''])|first)
+      when: (group_names != ['clients'] and group_names != ['clients', '_filtered_clients'] and group_names != ['_filtered_clients', 'clients']) or (inventory_hostname == groups.get('_filtered_clients', [''])|first)
     - import_role:
         name: ceph-container-common
       tags: fetch_container_image
-      when: (group_names != ['clients']) or (inventory_hostname == groups.get('clients', [''])|first)
+      when: (group_names != ['clients'] and group_names != ['clients', '_filtered_clients'] and group_names != ['_filtered_clients', 'clients']) or (inventory_hostname == groups.get('_filtered_clients', [''])|first)
 
 - hosts: mons
   gather_facts: false
index 07c2e8bfb48d41f8b4120bc91cb2abf874a5ea6e..b4526cace34373a3726dbebade1d08fef40ca7a7 100644 (file)
   tasks:
     - import_role:
         name: ceph-defaults
+
+    # dummy container setup is only supported on x86_64
+    # when running with containerized_deployment: true this task
+    # creates a group that contains only x86_64 hosts.
+    # 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.get(client_group_name, []) | intersect(ansible_play_batch) }}"
+      when: (hostvars[item]['ansible_facts']['architecture'] == 'x86_64') or (not containerized_deployment | bool)
+
     - import_role:
         name: ceph-facts
     - import_role: