From 21520229260bf50b958680955116124822350c9c Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Mon, 19 May 2025 17:40:54 +0200 Subject: [PATCH] debian-based distro: handle apt update cache when installing packages The package module pass options to the underlying packages manager module if they support it. No need to handle it in bootstrap. --- roles/bootstrap_os/tasks/debian.yml | 12 ------------ roles/system_packages/tasks/main.yml | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/roles/bootstrap_os/tasks/debian.yml b/roles/bootstrap_os/tasks/debian.yml index 9b18baa06..acfc0483b 100644 --- a/roles/bootstrap_os/tasks/debian.yml +++ b/roles/bootstrap_os/tasks/debian.yml @@ -50,15 +50,3 @@ become: true when: - need_bootstrap.rc != 0 - -- name: Update Apt cache - raw: apt-get update --allow-releaseinfo-change - become: true - when: - - os_release_dict['ID'] == 'debian' - - os_release_dict['VERSION_ID'] in ["10", "11"] - register: bootstrap_update_apt_result - changed_when: - - '"changed its" in bootstrap_update_apt_result.stdout' - - '"value from" in bootstrap_update_apt_result.stdout' - ignore_errors: true diff --git a/roles/system_packages/tasks/main.yml b/roles/system_packages/tasks/main.yml index 97d0cbb72..909110b6e 100644 --- a/roles/system_packages/tasks/main.yml +++ b/roles/system_packages/tasks/main.yml @@ -69,6 +69,7 @@ package: name: "{{ item.packages | dict2items | selectattr('value', 'ansible.builtin.all') | map(attribute='key') }}" state: "{{ item.state }}" + update_cache: true register: pkgs_task_result until: pkgs_task_result is succeeded retries: "{{ pkg_install_retries }}"