]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
defaults: fix handlers for collocation 2072/head
authorSébastien Han <seb@redhat.com>
Tue, 17 Oct 2017 13:54:17 +0000 (15:54 +0200)
committerSébastien Han <seb@redhat.com>
Wed, 18 Oct 2017 07:16:32 +0000 (09:16 +0200)
When doing collocation the condition "inventory_hostname in play_hosts"
is breaking the restart workflow.

Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit 90b75185d5fc473b377fafced95d7b35a80896aa)
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-defaults/handlers/main.yml

index e0e9ca4e49d27ddad351028288ac9452c5678c8a..7a10889df5a190c4f8920699f25c0f8e7baceacf 100644 (file)
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - mon_group_name in group_names
     - not containerized_deployment
+    - inventory_hostname == groups.get(mon_group_name) | last
+    - inventory_hostname in play_hosts
     - mon_socket_stat.rc == 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[mon_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - mon_group_name in group_names
     - containerized_deployment
+    - inventory_hostname == groups.get(mon_group_name) | last
+    - inventory_hostname in play_hosts
     - ceph_mon_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[mon_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
@@ -62,6 +66,7 @@
   when:
     - osd_group_name in group_names
     - not containerized_deployment
+    - inventory_hostname == groups.get(osd_group_name) | last
     # We do not want to run these checks on initial deployment (`socket_osd_container.results[n].rc == 0`)
     # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
     - ((crush_location is defined and crush_location) or osd_socket_stat.rc == 0)
@@ -69,7 +74,7 @@
     - handler_health_osd_check
     # See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below
     - inventory_hostname in play_hosts
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[osd_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
     - osd_group_name in group_names
     - containerized_deployment
+    - inventory_hostname == groups.get(osd_group_name) | last
     - ((crush_location is defined and crush_location) or ceph_osd_container_stat.get('stdout_lines', [])|length != 0)
     - handler_health_osd_check
     # See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below
     - inventory_hostname in play_hosts
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[osd_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - mds_group_name in group_names
     - not containerized_deployment
+    - inventory_hostname == groups.get(mds_group_name) | last
+    - inventory_hostname in play_hosts
     - mds_socket_stat.rc == 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[mds_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - mds_group_name in group_names
     - containerized_deployment
+    - inventory_hostname == groups.get(mds_group_name) | last
+    - inventory_hostname in play_hosts
     - ceph_mds_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[mds_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - rgw_group_name in group_names
     - not containerized_deployment
+    - inventory_hostname == groups.get(rgw_group_name) | last
+    - inventory_hostname in play_hosts
     - rgw_socket_stat.rc == 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[rgw_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - rgw_group_name in group_names
     - containerized_deployment
+    - inventory_hostname == groups.get(rgw_group_name) | last
+    - inventory_hostname in play_hosts
     - ceph_rgw_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[rgw_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - nfs_group_name in group_names
     - not containerized_deployment
+    - inventory_hostname == groups.get(nfs_group_name) | last
+    - inventory_hostname in play_hosts
     - nfs_socket_stat.rc == 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[nfs_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - nfs_group_name in group_names
     - containerized_deployment
+    - inventory_hostname == groups.get(nfs_group_name) | last
+    - inventory_hostname in play_hosts
     - ceph_nfs_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[nfs_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - rbdmirror_group_name in group_names
     - not containerized_deployment
+    - inventory_hostname == groups.get(rbdmirror_group_name) | last
+    - inventory_hostname in play_hosts
     - rbd_mirror_socket_stat.rc == 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[rbdmirror_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - rbdmirror_group_name in group_names
     - containerized_deployment
+    - inventory_hostname == groups.get(rbdmirror_group_name) | last
+    - inventory_hostname in play_hosts
     - ceph_rbd_mirror_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[rbdmirror_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - mgr_group_name in group_names
     - not containerized_deployment
+    - inventory_hostname == groups.get(mgr_group_name) | last
+    - inventory_hostname in play_hosts
     - mgr_socket_stat.rc == 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[mgr_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"
 
     # We do not want to run these checks on initial deployment (`socket.rc == 0`)
     - mgr_group_name in group_names
     - containerized_deployment
+    - inventory_hostname == groups.get(mgr_group_name) | last
+    - inventory_hostname in play_hosts
     - ceph_mgr_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ ansible_play_batch }}"
+  with_items: "{{ groups[mgr_group_name] }}"
   run_once: true
   delegate_to: "{{ item }}"