--- - name: Reboot VM tags: reboot_vm block: - name: Rebooting hosts ansible.windows.win_reboot: msg: "rebooting VM, initiated by ansible" reboot_timeout: 3600 - name: Logging action vars: ansible_connection: local ansible.builtin.shell: cmd: echo "Reboot {{ os_project }}-{{ ansible_hostname }} $(date '+%Y-%m-%d %H:%M:%S')" >> /deployments/{{ os_project }}-{{ win_project }}/action.log delegate_to: localhost