ansible / ansible.builtin / v2.9.26 / module / reboot Reboot a machine | "added in version" 2.7 of ansible.builtin" Authors: Matt Davis (@nitzmahone), Sam Doran (@samdoran) preview | supported by coreansible.builtin.reboot (v2.9.26) — module
pip
Install with pip install ansible==2.9.26
Reboot a machine, wait for it to go down, come back up, and respond to commands.
For Windows targets, use the M(win_reboot) module instead.
- name: Unconditionally reboot the machine with all defaults reboot:
- name: Reboot a slow machine that might have lots of updates to apply reboot: reboot_timeout: 3600
msg: default: Reboot initiated by Ansible description: - Message to display to users before reboot. type: str search_paths: default: - /sbin - /usr/sbin - /usr/local/sbin description: - Paths to search on the remote machine for the C(shutdown) command. - I(Only) these paths will be searched for the C(shutdown) command. C(PATH) is ignored in the remote node when searching for the C(shutdown) command. type: list version_added: '2.8' version_added_collection: ansible.builtin test_command: default: whoami description: - Command to run on the rebooted host and expect success from to determine the machine is ready for further tasks. type: str reboot_timeout: default: 600 description: - Maximum seconds to wait for machine to reboot and respond to a test command. - This timeout is evaluated separately for both reboot verification and test command success so the maximum execution time for the module is twice this amount. type: int connect_timeout: description: - Maximum seconds to wait for a successful connection to the managed hosts before trying again. - If unspecified, the default setting for the underlying connection plugin is used. type: int pre_reboot_delay: default: 0 description: - Seconds to wait before reboot. Passed as a parameter to the reboot command. - On Linux, macOS and OpenBSD, this is converted to minutes and rounded down. If less than 60, it will be set to 0. - On Solaris and FreeBSD, this will be seconds. type: int post_reboot_delay: default: 0 description: - Seconds to wait after the reboot command was successful before attempting to validate the system rebooted successfully. - This is useful if you want wait for something to settle despite your connection already working. type: int
elapsed: description: The number of seconds that elapsed waiting for the system to be rebooted. returned: always sample: 23 type: int rebooted: description: true if the machine was rebooted returned: always sample: true type: bool