--- - name: Set _mgr_handler_called before restart ansible.builtin.set_fact: _mgr_handler_called: true - name: Copy mgr restart script ansible.builtin.template: src: restart_mgr_daemon.sh.j2 dest: "{{ tmpdirpath.path }}/restart_mgr_daemon.sh" owner: root group: root mode: "0750" when: tmpdirpath.path is defined - name: Restart ceph mgr daemon(s) ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_mgr_daemon.sh when: - hostvars[item]['handler_mgr_status'] | default(False) | bool - hostvars[item]['_mgr_handler_called'] | default(False) | bool - hostvars[item].tmpdirpath.path is defined with_items: "{{ groups[mgr_group_name] }}" delegate_to: "{{ item }}" changed_when: false run_once: true - name: Set _mgr_handler_called after restart ansible.builtin.set_fact: _mgr_handler_called: false