This Ansible Collection provides playbooks for managing Ubuntu systems, including package upgrades, service restarts, and system reboots. These playbooks are designed to be modular and reusable, leveraging Ansible roles for specific tasks.
- Ansible Core 2.10 or later.
- Target hosts must be Ubuntu systems.
You can install this collection from Ansible Galaxy:
ansible-galaxy collection install bartmichu.ubuntu_maintenanceThis collection includes the following playbooks:
-
add_user.yamlAdds and configures a local user account with SSH key and optional sudo privileges. Can be run on newly provisioned servers, before they are fully integrated into your Ansible infrastructure, to bootstrap a dedicated Ansible user account. See
docs/add_user.mdfor more details. -
add_user_key.yamlInstalls a public key into the user's authorized_keys. It can optionally make the provided key the only authorized key (exclusive mode). See
docs/add_user_key.mdfor more details. -
check_state.yamlChecks the state of an Ubuntu system, including available package upgrades (security and regular), services requiring a restart, and whether a system reboot is needed. Provides a summary of the findings. Seedocs/check_state.mdfor more details. -
reboot_conditionally.yamlPerforms a system reboot only when necessary (due to pending updates or service restarts requiring a reboot) and when explicitly allowed via theumc_global_allow_rebootvariable. Seedocs/reboot_conditionally.mdfor more details. -
reboot_unconditionally.yamlPerforms an unconditional system reboot. Use with caution! Seedocs/reboot_unconditionally.mdfor more details. -
services_restart.yamlRestarts services that require it, using theneedrestartutility. Performs a check before and after attempting the restarts to identify which services were successfully restarted and which still require attention. Seedocs/services_restart.mdfor more details. -
shutdown_unconditionally.yamlPerforms an unconditional system shutdown. Use with caution! Seedocs/shutdown_unconditionally.mdfor more details. -
upgrade_all_reboot.yamlUpdates all upgradeable packages (including security updates) and reboots the system if necessary and allowed. Seedocs/upgrade_all.mdfor more details. -
upgrade_all.yamlUpdates all upgradeable packages (including security updates). Checks for required reboots and service restarts and reports on them. Seedocs/upgrade_all.mdfor more details. -
upgrade_security.yamlInstalls available security updates. Checks for required reboots and service restarts and reports on them. Seedocs/upgrade_security.mdfor more details.
See the individual role directories for their respective README.md files for more detailed information.
Several playbooks in this collection use variables. Please refer to the documentation for each playbook for specific variable requirements. A key variable used across many playbooks is umc_global_allow_reboot, which controls whether reboots are permitted, as well as umc_global_services_require_reboot and umc_global_allow_services_restart.
This playbook is licensed under MIT License.