commit bd974a455e8a3e542a2e3d82788ec42e9b5561ee Author: Grok Date: Sat Aug 9 13:32:10 2025 +0000 Add update-system Ansible playbook for applying system updates diff --git a/update-system.yml b/update-system.yml new file mode 100644 index 0000000..9554d09 --- /dev/null +++ b/update-system.yml @@ -0,0 +1,44 @@ +--- +# update-system.yml +# Ansible playbook to apply system updates on Linux servers +# Supports Debian/Ubuntu and RedHat/CentOS/Fedora families + +- name: Apply system updates + hosts: all + become: true + tasks: + - name: Update package cache for Debian-based systems + ansible.builtin.apt: + update_cache: true + when: ansible_os_family == "Debian" + + - name: Upgrade all packages for Debian-based systems + ansible.builtin.apt: + upgrade: dist + autoremove: true + autoclean: true + when: ansible_os_family == "Debian" + + - name: Update package cache for RedHat-based systems (dnf) + ansible.builtin.dnf: + update_cache: true + when: ansible_pkg_mgr == "dnf" + + - name: Upgrade all packages for RedHat-based systems (dnf) + ansible.builtin.dnf: + name: "*" + state: latest # noqa package-latest + when: ansible_pkg_mgr == "dnf" + + - name: Update package cache for RedHat-based systems (yum) + ansible.builtin.yum: + update_cache: true + when: ansible_pkg_mgr == "yum" + + - name: Upgrade all packages for RedHat-based systems (yum) + ansible.builtin.yum: + name: "*" + state: latest # noqa package-latest + when: ansible_pkg_mgr == "yum" + +# End of playbook