From 8cb693a950ad7a4783293b0201ec8ed9af3a453c Mon Sep 17 00:00:00 2001
From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
Date: Tue, 13 Jun 2023 13:45:12 +0200
Subject: [PATCH] apt/repositories: Update cache only once at the end

---
 apt/tasks/repositories.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apt/tasks/repositories.yml b/apt/tasks/repositories.yml
index 43af1ee..5c48ba2 100644
--- a/apt/tasks/repositories.yml
+++ b/apt/tasks/repositories.yml
@@ -6,6 +6,7 @@
   apt_repository:
     state: present
     repo: "deb{{ src }} {{ apt_mirror }} {{ ansible_distribution_release }}{{ item[1] }} {{ item[0] }}"
+    update_cache: false
   with_nested:
     - "{{ apt_repos }}"
     - "{{ apt_sets|union([''])|unique }}"
@@ -19,6 +20,7 @@
   apt_repository:
     state: absent
     repo: "deb{{ src }} {{ apt_mirror }} {{ ansible_distribution_release }}{{ item[1] }} {{ item[0] }}"
+    update_cache: false
   with_nested:
     - "{{ apt_repos }}"
     - "{{ ['', '-updates', '-backports', '-proposed-updates']|difference(apt_sets|union([''])) }}"
@@ -32,6 +34,7 @@
   apt_repository:
     state: absent
     repo: "deb{{ src }} {{ apt_mirror }} {{ ansible_distribution_release }}{{ item[1] }} {{ item[0] }}"
+    update_cache: false
   with_nested:
     - "{{ ['main', 'contrib', 'non-free']|difference(apt_repos) }}"
     - ['', '-updates', '-backports', '-proposed-updates']
@@ -45,6 +48,7 @@
   apt_repository:
     state: present
     repo: "deb{{ src }} {{ apt_mirror_security }} {{ ansible_distribution_release }}{{ item[1] }} {{ item[0] }}"
+    update_cache: false
   with_nested:
     - "{{ apt_repos }}"
     - "{{ ['/updates'] if ansible_distribution_major_version|int(default=99) < 11 else ['-security'] }}"
@@ -59,6 +63,7 @@
   apt_repository:
     state: absent
     repo: "deb{{ src }} {{ apt_mirror_security }} {{ ansible_distribution_release }}{{ item[1] }} {{ item[0] }}"
+    update_cache: false
   with_nested:
     - "{{ ['main', 'contrib', 'non-free']|difference(apt_repos) }}"
     - "{{ ['/updates'] if ansible_distribution_major_version|int(default=99) < 11 else ['-security'] }}"
-- 
GitLab