A simple wrapper role for the scheduled-reboot tool.
Scheduled-reboot provides a method to control scheduled rebooting of systems that can optionally:
- Run package upgrades immediately prior to shutdown
- Run pre-reboot scripts
- Run recovery scripts in response to any pre-reboot task failures
- Run post-reboot scripts
- Log everything
- Email when problems are encountered
- Ansible 2+
- scheduled-reboot package. You must host this yourself, it's not on a public PPA
Note: Some variables are mandatory and should be set in group_vars. Other vars will simply no-op if unset.
Set the system reboot schedule time, in cron notation. Default: unset
reboot_schedule: '50 5 * * *'
A space-separated list of recipients to send email to when problems occur. Default: 'root'
scheduled_reboot_mailto: root [email protected]
Send a notification email at script exection time when scheduled-reboot is disabled. Mandatory. Default: unset
scheduled_reboot_email_when_disabled: true
Ensure scheduled-reboot
cron job is present or absent. Default: absent
scheduled_reboot_cronjob_state: absent
Package state for 'scheduled-reboot' package. [absent, latest, present] Default: present
scheduled_reboot_package_state: present
Should post-reboot systemd one-shot service be enabled? [true|false] Default: true Controls the one-shot service that runs post-boot user scripts.
scheduled_reboot_post_reboot_service_enabled: true
Run package upgrades immediately prior to reboot [true|false] Default: false
scheduled_reboot_upgrade_at_shutdown: false
- hosts: servers
roles:
- scheduled-reboot
vars:
reboot_schedule: '50 5 * * *'
scheduled_reboot_cronjob_state: present
scheduled_reboot_email_when_disabled: true
scheduled_reboot_mailto: root [email protected]
scheduled_reboot_package_state: present
scheduled_reboot_post_reboot_service_enabled: true
scheduled_reboot_scheduled_reboots_disabled: false
scheduled_reboot_upgrade_at_shutdown: true
MIT
This role was created in 2021 by Kodiak Firesmith, an ops guy at Woods Hole Oceanographic Institution. Aside from GitHub, I'm most active on LinkedIn.