chore: first commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: Check if pacman is not locked
|
||||
stat:
|
||||
path: /var/lib/pacman/db.lck
|
||||
register: pacman_lock
|
||||
failed_when: pacman_lock.stat.exists
|
||||
changed_when: false
|
||||
|
||||
## Only if your are sure of what you are doing
|
||||
# - name: Unlock pacman lock
|
||||
# file:
|
||||
# path: /var/lib/pacman/db.lck
|
||||
# state: absent
|
||||
|
||||
- name: Install reflector (looking for fastest mirror)
|
||||
pacman:
|
||||
name: reflector
|
||||
state: present
|
||||
|
||||
- name: Stat pacman mirrorlist
|
||||
stat:
|
||||
path: /etc/pacman.d/mirrorlist
|
||||
register: mirrorlist
|
||||
|
||||
# Probably not here if it's a fresh install
|
||||
- name: Stat pacman mirrorlist.bak
|
||||
stat:
|
||||
path: /etc/pacman.d/mirrorlist.bak
|
||||
register: mirrorlist_bak
|
||||
|
||||
- name: Backup and update pacman mirrorlist if older than 7 days
|
||||
shell: >
|
||||
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak &&
|
||||
reflector --latest 20 --protocol https --sort rate
|
||||
--save /etc/pacman.d/mirrorlist
|
||||
when: mirrorlist_bak.stat.exists is false or
|
||||
(mirrorlist.stat.exists and
|
||||
(ansible_date_time.epoch | int - mirrorlist.stat.mtime) > 604800)
|
||||
|
||||
- name: Configure pacman to output colors
|
||||
lineinfile:
|
||||
dest: /etc/pacman.conf
|
||||
state: present
|
||||
regexp: "^(.*)Color"
|
||||
line: "Color"
|
||||
Reference in New Issue
Block a user