dotfiles/roles/base_system/tasks/upgrade.yml
Matej Focko 4ca89d7641
fix(base_system): improve the system-wide upgrade
When upgrading packages to their latest version, decide which Ansible
module to use based on the ‹pkg_mgr› Ansible fact instead of the
distribution.

This approach is more robust, and more correct, as the package managers
are shared between some of the distributions.

Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-12-14 20:35:25 +01:00

19 lines
454 B
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: Upgrade all packages with apt
ansible.builtin.apt:
name: "*"
state: latest
update_cache: true
when: ansible_facts.pkg_mgr == "apt"
- name: Upgrade all packages with dnf
ansible.builtin.dnf:
name: "*"
state: latest
when: ansible_facts.pkg_mgr == "dnf"
- name: Upgrade all packages with zypper
community.general.zypper:
name: "*"
state: latest
when: ansible_facts.pkg_mgr == "zypper"