Files
System-Updater/Updates.yml
2026-02-11 22:52:52 +01:00

64 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
- name: Testbook
remote_user: root
hosts: all
gather_facts: true
tasks:
- name: Pingo
ansible.builtin.ping:
- name: Infos über Packete abholen
ansible.builtin.package_facts:
manager: auto
strategy: first
- name: Systeme Aktualisierung
notify: System Herunterfahren
block:
- name: Update Debian Systeme
ansible.builtin.apt:
update_cache: true
upgrade: full
when: ansible_os_family == "Debian"
register: apt_result
- name: Update Fedora Systeme
tags: dnf
ansible.builtin.dnf:
name: "*"
update_cache: true
update_only: false
state: latest
when: ansible_os_family == "RedHat"
register: dnf_result
- name: Flatpaks abrufen
become: true
become_user: "{{ flatpak_user }}"
ansible.builtin.command:
cmd: flatpak list --user --app --columns=application
register: flatpak_list
changed_when: false
when:
- "'flatpak' in ansible_facts.packages"
- name: Update flatpak
become: true
become_user: "{{ flatpak_user }}"
community.general.flatpak:
name: "{{ item }}"
method: user
state: latest
loop: "{{ flatpak_list.stdout_lines }}"
register: flatpak_result
when: "'flatpak' in ansible_facts.packages"
changed_when: (flatpak_result.results | default([]) | selectattr('changed') | list | length > 0)
handlers:
- name: System Herunterfahren
become: true
ansible.builtin.command:
cmd: shutdown -h +1 "Updates fertig System fährt herunter"
async: 1
poll: 0