From ffeb6e865839e1e8027afca072723a8f48561c7d Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Sun, 5 Jul 2026 17:19:31 +0200 Subject: [PATCH] Avoid potential partial upgrades with Arch Ansible tasks - update_servers: checkupdats uses its own separate local DB. We don't need to update the pacman one beforehand, we can just do it from the upgrade task. - add_package: updating the local DB with 'update_cache: true' when installing a package is effectively the same as 'pacman -Sy '. Also adopt a more precise name for the related task for Alpine and Debian while we're at it. --- Ansible/roles/add_package/tasks/main.yml | 1 - Ansible/roles/update_servers/tasks/alpine.yml | 2 +- Ansible/roles/update_servers/tasks/arch.yml | 5 +---- Ansible/roles/update_servers/tasks/debian.yml | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Ansible/roles/add_package/tasks/main.yml b/Ansible/roles/add_package/tasks/main.yml index d2f924ab..ed097e90 100644 --- a/Ansible/roles/add_package/tasks/main.yml +++ b/Ansible/roles/add_package/tasks/main.yml @@ -15,7 +15,6 @@ - name: "Install package(s) - Arch" community.general.pacman: - update_cache: true name: "{{ package_arch }}" state: present when: ansible_facts['distribution'] == "Archlinux" and (package_arch is defined and package_arch | length > 0) diff --git a/Ansible/roles/update_servers/tasks/alpine.yml b/Ansible/roles/update_servers/tasks/alpine.yml index 22c35de3..351d1e8e 100644 --- a/Ansible/roles/update_servers/tasks/alpine.yml +++ b/Ansible/roles/update_servers/tasks/alpine.yml @@ -1,5 +1,5 @@ --- -- name: "Update repos" +- name: "Update local repo DB" community.general.apk: update_cache: true diff --git a/Ansible/roles/update_servers/tasks/arch.yml b/Ansible/roles/update_servers/tasks/arch.yml index 420047c7..47762455 100644 --- a/Ansible/roles/update_servers/tasks/arch.yml +++ b/Ansible/roles/update_servers/tasks/arch.yml @@ -1,8 +1,4 @@ --- -- name: "Update repos" - community.general.pacman: - update_cache: true - - name: "Get packages to update" ansible.builtin.shell: cmd: checkupdates @@ -17,6 +13,7 @@ - name: "Update servers" community.general.pacman: + update_cache: true upgrade: true - name: "Get orphan packages" diff --git a/Ansible/roles/update_servers/tasks/debian.yml b/Ansible/roles/update_servers/tasks/debian.yml index 7fb5cde3..a72356c5 100644 --- a/Ansible/roles/update_servers/tasks/debian.yml +++ b/Ansible/roles/update_servers/tasks/debian.yml @@ -1,5 +1,5 @@ --- -- name: "Update repos" +- name: "Update local repo DB" ansible.builtin.apt: update_cache: true