--- - name: set _tcmu_runner_handler_called before restart set_fact: _tcmu_runner_handler_called: True - name: copy tcmu-runner restart script template: src: restart_tcmu_runner.sh.j2 dest: "{{ tmpdirpath.path }}/restart_tcmu_runner.sh" owner: root group: root mode: 0750 - name: restart tcmu-runner command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_tcmu_runner.sh when: - ceph_tcmu_runner_stat.get('rc') == 0 - hostvars[item]['_tcmu_runner_handler_called'] | default(False) | bool - ceph_tcmu_runner_stat.get('stdout_lines', [])|length != 0 with_items: "{{ groups[iscsi_gw_group_name] }}" delegate_to: "{{ item }}" run_once: True - name: set _tcmu_runner_handler_called after restart set_fact: _tcmu_runner_handler_called: False