Update role
Install system and package updates with automatic reboot support for multiple Linux distributions.
Requires
The Ansible Update role supports these package managers:
- apt (Debian, Ubuntu)
- yum (CentOS)
- zypper (SLES)
- dnf (AlmaLinux, RHEL)
Usage
Configure the role in your inventory:
1 2 3 | |
Include the role in your playbook:
1 2 3 4 | |
The role provides this tag:
- update - Run system updates
Docs
Run system updates on all hosts:
1 | |
Run updates only (without other deployment tasks):
1 | |
Configuration Options
update_update: true- Enable system updates (default:true)update_reboot_allowed: true- Allow automatic reboot if required (default:true)
Behavior
The role will:
1. Detect the operating system and package manager
2. Update package cache
3. Install all available updates
4. Reboot the system if update_reboot_allowed: true and a reboot is required
5. Wait for the system to come back online after reboot
Distribution-Specific Tasks
The role automatically selects the appropriate update method:
- Debian/Ubuntu: apt update && apt upgrade
- CentOS: yum update
- SLES: zypper update
- AlmaLinux/RHEL: dnf update
