From 330e717ed8f40b3a052fab9ba84cd4a2241694fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20St=C3=A9phane?= Date: Sun, 20 Nov 2022 12:18:24 +0100 Subject: [PATCH] Fix: Add update Cache --- tasks/main.yml | 4 +++- tasks/update_cache.yml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tasks/update_cache.yml diff --git a/tasks/main.yml b/tasks/main.yml index c271098..3fa7994 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -28,7 +28,9 @@ block: - name: Gather ansible facts ansible.builtin.setup: - + - name: Update cache + ansible.builtin.include_tasks: + file: update_cache.yml - name: Install bootstrap packages (package) become: true ansible.builtin.package: diff --git a/tasks/update_cache.yml b/tasks/update_cache.yml new file mode 100644 index 0000000..214f637 --- /dev/null +++ b/tasks/update_cache.yml @@ -0,0 +1,36 @@ +- name: Update apt cache + ansible.builtin.apt: + update_cache: yes + when: ansible_pkg_mgr == "apt" + become: true + +- name: Update yum cache + ansible.builtin.yum: + update_cache: yes + when: ansible_pkg_mgr == "yum" + become: true + +- name: Update apk cache + community.general.apk: + update_cache: yes + when: ansible_pkg_mgr == "apk" + become: true + +- name: Update dnf cache + ansible.builtin.dnf: + update_cache: yes + when: ansible_pkg_mgr == "dnf" + become: true + +- name: Update zypper cache + community.general.zypper: + name: zypper + update_cache: yes + when: ansible_pkg_mgr == "zypper" + become: true + +- name: Update pacman cache + community.general.pacman: + update_cache: yes + when: ansible_pkg_mgr == "pacman" + become: true \ No newline at end of file