--- - name: set _rbd_target_api_handler_called before restart set_fact: _rbd_target_api_handler_called: True - name: restart rbd-target-api service: name: rbd-target-api state: restarted when: - ceph_rbd_target_api_stat.get('rc') == 0 - hostvars[item]['_rbd_target_api_handler_called'] | default(False) | bool - ceph_rbd_target_api_stat.get('stdout_lines', [])|length != 0 with_items: "{{ groups[iscsi_gw_group_name] }}" delegate_to: "{{ item }}" run_once: True - name: set _rbd_target_api_handler_called after restart set_fact: _rbd_target_api_handler_called: False - name: set _rbd_target_gw_handler_called before restart set_fact: _rbd_target_gw_handler_called: True - name: restart rbd-target-gw service: name: rbd-target-gw state: restarted when: - ceph_rbd_target_gw_stat.get('rc') == 0 - hostvars[item]['_rbd_target_gw_handler_called'] | default(False) | bool - ceph_rbd_target_gw_stat.get('stdout_lines', [])|length != 0 with_items: "{{ groups[iscsi_gw_group_name] }}" delegate_to: "{{ item }}" run_once: True - name: set _rbd_target_gw_handler_called after restart set_fact: _rbd_target_gw_handler_called: False