ceph-handler: don't restart all OSDs with limit

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>
pull/4530/head
Dimitri Savineau 2019-10-02 14:48:53 -04:00 committed by Dimitri Savineau
parent 780cf36a59
commit 0346871fb5
1 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,7 @@
- ceph_current_status.fsid is defined - ceph_current_status.fsid is defined
- handler_health_osd_check | bool - handler_health_osd_check | bool
- hostvars[item]['_osd_handler_called'] | default(False) | 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 }}" delegate_to: "{{ item }}"
run_once: True run_once: True
@ -108,7 +108,7 @@
- ceph_osd_container_stat.get('stdout_lines', [])|length != 0 - ceph_osd_container_stat.get('stdout_lines', [])|length != 0
- handler_health_osd_check | bool - handler_health_osd_check | bool
- hostvars[item]['_osd_handler_called'] | default(False) - 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 }}" delegate_to: "{{ item }}"
run_once: True run_once: True