GROG.poweroff
Poweroff
A role for shutting down servers.
By default, this role will not work if the server is already off. However, if poweroff_strict
is set to false
, the system will first check if the server is reachable, and only then will it shut it down.
Requirements
- Servers must be set up for Ansible (must have Python and others installed).
- Must have root access, e.g.,
become: yes
.
Role Variables
Variable | Description | Default Value |
---|---|---|
poweroff_strict |
Don't ignore servers that are off or unreachable | true |
poweroff_ping_delay |
Time to wait before checking servers (in seconds) | 0 |
poweroff_ping_timeout |
Time to wait when checking servers (in seconds) | 30 |
poweroff_ping_port |
Port to use when checking | 22 |
poweroff_message |
Message to log when shutting down | 'Power off by Ansible' |
poweroff_interval |
Wait time between shutting down and the next task? | 'no' |
poweroff_interval_seconds |
Seconds to pause after shutting down | 0 |
Note:
All boolean values can be specified as either 'yes'
/'no'
or true
/false
. This lets you change them from the command line (-e "bool=yes"
) without any issues.
Dependencies
None.
Example Playbook
Basic shutdown example:
---
- hosts: servers
roles:
- { role: GROG.poweroff,
become: yes,
poweroff_message: 'Test poweroff role'
}
Contributing
Any help, changes, or ideas are welcome here!
Author
By G. Roggemans
License
MIT