Zum Inhalt

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
# host_vars/docker01.yml
update_update: true
update_reboot_allowed: true

Include the role in your playbook:

1
2
3
4
# playbooks/proxmox/deploy_docker_base.yml
- hosts: update
  roles:
    - role: update

The role provides this tag: - update - Run system updates

Docs

Run system updates on all hosts:

1
ansible-playbook -i inventory/hosts.yml playbooks/proxmox/setup_update.yml

Run updates only (without other deployment tasks):

1
ansible-playbook -i inventory/hosts.yml playbooks/proxmox/deploy_docker_base.yml --tags update

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