No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-18 09:33:36 +00:00
defaults first id 2026-09-18 07:56:01 +00:00
meta add meta/main.yaml 2026-09-18 09:19:10 +00:00
tasks change variable to new schema 2026-09-18 09:33:36 +00:00
.gitignore first id 2026-09-18 07:56:01 +00:00
LICENSE first id 2026-09-18 07:56:01 +00:00
README.md first id 2026-09-18 07:56:01 +00:00

OS Update

Eine Ansible Role zum automatisierten Installieren von Betriebssystem-Updates auf Debian/Ubuntu, RHEL/CentOS/Alma/Rocky und SUSE Linux. Die Rolle unterscheidet zwischen vollständigen Updates und Sicherheitsupdates und prüft am Ende, ob ein Neustart erforderlich ist.

Funktionen

  • Debian/Ubuntu: apt-basierte Aktualisierung
  • Red Hat / CentOS / Rocky / Alma: dnf-basierte Aktualisierung
  • SUSE / SLES: zypper-basierte Aktualisierung
  • Auswahl zwischen security und all
  • Automatischer Neustart, falls erforderlich und erlaubt
  • Reboot-Prüfung mit Betriebssystem-spezifischen Mechanismen

Voraussetzungen

  • Ansible >= 2.10
  • Zielsysteme mit unterstütztem Betriebssystem:
    • Debian / Ubuntu
    • RedHat basierte Systeme
    • SUSE Linux Enterprise / openSUSE
  • Root-Rechte oder sudo auf dem Zielsystem

Variablen

In defaults/main.yml sind die Standardwerte definiert:

---
# Optionen: 'security' oder 'all'
update_type: "security"

# Neustart standardmäßig AKTIV (kann zur Laufzeit überschrieben werden)
allow_reboot: true

update_type

  • security: installiert nur Sicherheitsupdates
  • all: aktualisiert alle Pakete auf die jeweils aktuelle Version

allow_reboot

  • true: erlaubt der Rolle einen Neustart, falls das System nach dem Update neu gestartet werden muss
  • false: deaktiviert den Neustart auch dann, wenn ein Reboot erforderlich ist

Beispiel

- hosts: all
  become: true
  roles:
    - role: os-update
      vars:
        update_type: "security"
        allow_reboot: true

Beispiel mit vollständigem Update

- hosts: linux
  become: true
  tasks:
    - name: OS-Updates durchführen
      ansible.builtin.include_role:
        name: os-update
      vars:
        update_type: "all"
        allow_reboot: false

Ablauf der Rolle

  1. Ermittlung des Betriebssystems via ansible_os_family
  2. Ausführen des passenden Tasks für Debian, RedHat oder SUSE
  3. Prüfung, ob ein Neustart erforderlich ist
  4. Optionaler Neustart mit ansible.builtin.reboot

Unterstützte Betriebssystemfamilien

  • Debian
  • RedHat
  • Suse

Lizenz

Diese Rolle steht unter der MIT-Lizenz. Siehe die Datei LICENSE für den vollständigen Text.

MIT License

Copyright (c) 2026

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.