From 29384509936abbd49cd0ff5af2350122cb3e1ec5 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 13 Sep 2023 16:25:21 +0200 Subject: move rate_mirrors inside of pacman --- roles/pacman/tasks/main.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'roles/pacman/tasks') diff --git a/roles/pacman/tasks/main.yml b/roles/pacman/tasks/main.yml index dad1148..972fddf 100644 --- a/roles/pacman/tasks/main.yml +++ b/roles/pacman/tasks/main.yml @@ -1,3 +1,22 @@ +- name: Use rate-mirrors if available + when: pacman_rate_mirrors + block: + - name: Check for rate-mirrors + ansible.builtin.command: rate-mirrors --version + register: rate_mirrors_version + changed_when: false + failed_when: false + + - name: Run rate-mirrors + when: rate_mirrors_version.rc == 0 + become: true + ansible.builtin.shell: | + . /etc/os-release && rate-mirrors \ + --allow-root \ + --disable-comments \ + --save /etc/pacman.d/mirrorlist \ + "$ID" + - name: Upgrade packages become: true community.general.pacman: -- cgit v1.2.3