The archlinux and zfs roles temporarily write `%wheel ALL=(ALL) NOPASSWD: ALL` to /etc/sudoers so makepkg/paru can run unattended, then restore it in a following task. Since the restore was a plain sibling task, any failure in between aborted the play and left the host with passwordless root for the whole wheel group. Move the restore into `always:` so it runs on failure too, and narrow the window in yay.yml to just the makepkg call (dependency install, directory setup and git clone no longer run inside it). This is not hypothetical: a provisioning run of omega failed on paru's git clone and left the sudoers hack in place. The clone failed because the deprecated compile-from-source paru block, which was commented out in tree, had been re-enabled. It fed paru_git_repo into the git module, but that variable now holds a GitHub owner/repo slug for the releases API rather than a clone URL. Remove the block outright, along with the orphaned paru_src_path default; paru is installed from the release binary. Also fix the ansible-lint violations this surfaced so roles/archlinux passes the production profile: explicit `become` next to `become_user`, a pinned branch on the yay clone, and `changed_when` on the command/shell tasks.
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
---
|
|
- name: Check if pacman is not locked
|
|
ansible.builtin.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)
|
|
community.general.pacman:
|
|
name: reflector
|
|
state: present
|
|
|
|
- name: Stat pacman mirrorlist
|
|
ansible.builtin.stat:
|
|
path: /etc/pacman.d/mirrorlist
|
|
register: mirrorlist
|
|
|
|
# Probably not here if it's a fresh install
|
|
- name: Stat pacman mirrorlist.bak
|
|
ansible.builtin.stat:
|
|
path: /etc/pacman.d/mirrorlist.bak
|
|
register: mirrorlist_bak
|
|
|
|
- name: Backup and update pacman mirrorlist if older than 7 days
|
|
ansible.builtin.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)
|
|
changed_when: true
|
|
|
|
- name: Configure pacman to output colors
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/pacman.conf
|
|
state: present
|
|
regexp: "^(.*)Color"
|
|
line: "Color"
|