]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-handler: don't restart all OSDs with limit
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 2 Oct 2019 18:48:53 +0000 (14:48 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Thu, 3 Oct 2019 18:52:27 +0000 (14:52 -0400)
When using the ansible --limit option on one or few OSD nodes and if the
handler is triggered then we will restart the OSD service on all OSDs
nodes instead of the hosts limited by the limit value.
Even if the play is limited by the --limit value we are using all OSD
nodes from the OSD group.

  with_items: '{{ groups[osd_group_name] }}'

Instead we should iterate only on the nodes present in both OSD group and
limit list.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
roles/ceph-handler/handlers/main.yml

index 59e7fc5af96027bd22ad1a11457595e16b4798bb..5ac3deeec8230c2514cb0406aae0a3a8ce3c7fce 100644 (file)
@@ -92,7 +92,7 @@
         - ceph_current_status.fsid is defined
         - handler_health_osd_check | bool
         - hostvars[item]['_osd_handler_called'] | default(False) | bool
-      with_items: "{{ groups[osd_group_name] }}"
+      with_items: "{{ groups[osd_group_name] | intersect(ansible_play_batch) }}"
       delegate_to: "{{ item }}"
       run_once: True
 
         - ceph_osd_container_stat.get('stdout_lines', [])|length != 0
         - handler_health_osd_check | bool
         - hostvars[item]['_osd_handler_called'] | default(False)
-      with_items: "{{ groups[osd_group_name] }}"
+      with_items: "{{ groups[osd_group_name] | intersect(ansible_play_batch) }}"
       delegate_to: "{{ item }}"
       run_once: True