Ansible Playbooks

Reboot Machine(s)

Welcome

This playbook reboots the target machines specified in the my_hosts variable, using elevated privileges to perform the reboot. It waits for up to an hour for the reboot process to complete and for the machines to become available again.

* Please be aware, the coding on this site is meant to guide. Testing these scripts in a non-production environment is strongly encouraged. I take no responsibility for use of any scripts on this site or on my github repositories.


Playbook:

---
- name: Reboot machine
  hosts: "{{ my_hosts | d([]) }}"
  become: true

  tasks:
    - name: Reboot machine
      ansible.builtin.reboot:
        reboot_timeout: 3600

View on GitHub