GROG.reboot
Reboot
A role for restarting computers.
Requirements
- The computers should be set up to use Ansible (need Python, etc.).
- You need root permissions, for example,
become: yes
.
Role Variables
Variable | Description | Default Value |
---|---|---|
reboot_message |
Message logged during the reboot | 'Reboot by Ansible' |
reboot_wait |
Wait for the computers to come back online? | 'yes' |
reboot_connect_timeout |
Time to wait before trying to connect again. | 20 seconds |
reboot_wait_host |
Which computer to check | ansible_ssh_host or inventory_hostname |
reboot_wait_port |
Port number to check | ansible_ssh_port or 22 |
reboot_wait_regex |
Text to look for in the connection (e.g., OpenSSH ) |
/ |
reboot_wait_delay |
Time to wait before checking the computer (in seconds) | 10 seconds |
reboot_wait_timeout |
Time to wait for the computer to start up (in seconds) | 300 seconds |
reboot_wait_ctimeout |
Timeout for each connection attempt (in seconds) | 5 seconds |
reboot_interval |
Wait time between rebooting and the next task? | 'no' |
reboot_interval_seconds |
Time to pause after reboot (in seconds) | 0 seconds |
Note:
You can use boolean values as either 'yes'
/'no'
or true
/false
. This makes it easy to change them from the command line (e.g., -e "bool=yes"
).
Dependencies
None.
Example Playbook
Basic reboot example:
---
- hosts: servers
become: yes
roles:
- role: GROG.reboot
reboot_message: 'Test reboot role'
Rolling reboot example:
---
- hosts: servers
become: yes
serial: 1
roles:
- role: GROG.reboot
reboot_interval: 'yes'
reboot_interval_seconds: 60
Contributing
Any help, changes, or ideas are welcome!
Author
By G. Roggemans
License
MIT