--- - name: set _rbdmirror_handler_called before restart set_fact: _rbdmirror_handler_called: True - name: copy rbd mirror restart script template: src: restart_rbd_mirror_daemon.sh.j2 dest: /tmp/restart_rbd_mirror_daemon.sh owner: root group: root mode: 0750 - name: restart ceph rbd mirror daemon(s) command: /usr/bin/env bash /tmp/restart_rbd_mirror_daemon.sh when: - handler_rbd_mirror_status | bool - hostvars[item]['_rbdmirror_handler_called'] | default(False) | bool with_items: "{{ groups[rbdmirror_group_name] }}" delegate_to: "{{ item }}" run_once: True - name: set _rbdmirror_handler_called after restart set_fact: _rbdmirror_handler_called: False