reboot - Reboot a machine

New in version 2.7.

Synopsis

Parameters

Parameter Choices/Defaults Comments
connect_timeout
int
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.
msg
str
Default:
Reboot initiated by Ansible
Message to display to users before reboot.
post_reboot_delay
int
Default:
0
Seconds to wait after the reboot was successful and the connection was re-established.
This is useful if you want wait for something to settle despite your connection already working.
pre_reboot_delay
int
Default:
0
Seconds for shutdown to wait before requesting reboot.
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.
reboot_timeout
int
Default:
600
Maximum seconds to wait for machine to reboot and respond to a test command.
This timeout is evaluated separately for both network connection and test command success so the maximum execution time for the module is twice this amount.
test_command
str
Default:
whoami
Command to run on the rebooted host and expect success from to determine the machine is ready for further tasks.

Notes

Note

  • For Windows targets, use the win_reboot module instead.

Examples

- 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

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
elapsed
int
always
The number of seconds that elapsed waiting for the system to be rebooted.

Sample:
23
rebooted
boolean
always
true if the machine was rebooted

Sample:
True


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as core which means that it is maintained by the Ansible Core Team. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Core Team, see here.

Support

For more information about Red Hat’s support of this module, please refer to this Knowledge Base article

Author

  • Matt Davis (@nitzmahone)
  • Sam Doran (@samdoran)

Hint

If you notice any issues in this documentation you can edit this document to improve it.