From fb075fe0288c322a9e29a0752ce13c0d57e1c0ce Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 6 Oct 2019 16:32:35 +0100 Subject: [PATCH] Install reflector to rank mirrors --- files/reflector.service | 11 +++++++++++ tasks/packages.yml | 29 +++++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 files/reflector.service diff --git a/files/reflector.service b/files/reflector.service new file mode 100644 index 0000000..9eb135b --- /dev/null +++ b/files/reflector.service @@ -0,0 +1,11 @@ +[Unit] +Description=Pacman mirrorlist update +Wants=network-online.target +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/reflector --verbose --sort rate -a 1 -p https --threads {{ ansible_facts.processor_vcpus }} --save /etc/pacman.d/mirrorlist + +[Install] +RequiredBy=multi-user.target diff --git a/tasks/packages.yml b/tasks/packages.yml index 88cf092..b1bb019 100644 --- a/tasks/packages.yml +++ b/tasks/packages.yml @@ -89,14 +89,23 @@ regexp: '^BUILDENV=' line: 'BUILDENV=(!distcc color ccache check !sign)' -- name: Download UK mirrorlist - get_url: - url: 'https://www.archlinux.org/mirrorlist/?country=GB&protocol=http&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on' - dest: /etc/pacman.d/mirrorlist - force: true +- name: "Install Reflector" + aur: + skip_installed: true + name: reflector + become: true + become_user: aur_builder -- name: Un-comment mirrorlist servers - replace: - path: /etc/pacman.d/mirrorlist - regexp: '^#Server = (.+)$' - replace: 'Server = \1' +- name: Install Reflector service + template: + src: ./files/reflector.service + dest: /etc/systemd/system/reflector.service + mode: 0644 + owner: root + group: root + +- name: Enable Reflector services + systemd: + name: "reflector" + enabled: true + state: started