Why updates deserve their own playbook

Update automation should not disappear inside a baseline role. Updates carry different risk: repositories change, reboots may be required, services must come back and maintenance windows must not be exceeded accidentally.

This part deliberately stays generic. It is not about SUSE Multi-Linux Manager, FreeIPA or Proxmox, but about a reusable Ansible pattern for Linux updates. Specialist cases belong in their own series.

Target design

  • Limit the target group before changing packages.

  • Prepare changes with check mode.

  • Process hosts in small batches.

  • Detect or trigger reboots deliberately.

  • Verify connectivity, services and baseline state after reboot.

Inventory groups for maintenance windows

yaml
all:
children:
linux:
children:
maintenance_window_a:
hosts:
sles16-client01.example.test:
maintenance_window_b:
hosts:
rocky10-client01.example.test:

Playbook with batch processing

yaml
# playbooks/linux-update.yaml
- name: Patch Linux systems in controlled batches
hosts: linux
become: true
gather_facts: true
serial: 2
max_fail_percentage: 20
pre_tasks:
- name: Confirm selected hosts
ansible.builtin.debug:
msg: "Updating {{ inventory_hostname }} in {{ ansible_play_hosts_all | length }} selected hosts"
tasks:
- name: Refresh package metadata and install available updates
ansible.builtin.package:
name: '*'
state: latest
- name: Reboot host when maintenance window allows it
ansible.builtin.reboot:
reboot_timeout: 900
test_command: whoami
when: linux_updates_allow_reboot | default(false)
post_tasks:
- name: Verify host is reachable after update
ansible.builtin.ping:

Variables instead of spontaneous decisions

yaml
# inventories/lab/group_vars/maintenance_window_a.yaml
linux_updates_allow_reboot: true
linux_updates_expected_services:
- sshd
- chronyd

Service validation after update

yaml
- name: Verify expected services are running
ansible.builtin.service_facts:
- name: Assert expected services are active
ansible.builtin.assert:
that:
- ansible_facts.services[item + '.service'].state == 'running'
fail_msg: "Expected service {{ item }} is not running"
loop: "{{ linux_updates_expected_services | default([]) }}"

Acceptance run

bash
ansible-playbook -i inventories/lab/hosts.yaml playbooks/linux-update.yaml --syntax-check
ansible-playbook -i inventories/lab/hosts.yaml playbooks/linux-update.yaml --limit maintenance_window_a --check --diff
ansible-playbook -i inventories/lab/hosts.yaml playbooks/linux-update.yaml --limit maintenance_window_a
ansible-playbook -i inventories/lab/hosts.yaml playbooks/linux-update.yaml --limit maintenance_window_a --check --diff

Acceptance table

Limits

This pattern does not replace central patch management or package approval. It describes the technical workflow that can later be connected to SUSE Multi-Linux Manager, repositories, change management or CI/CD.