Install reflector to rank mirrors

This commit is contained in:
Jake Howard 2019-10-06 16:32:35 +01:00
parent a7b8dfffdb
commit fb075fe028
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 30 additions and 10 deletions

11
files/reflector.service Normal file
View file

@ -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

View file

@ -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