summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-01-22 21:04:40 +0100
committerAhmed Abdelhalim <[email protected]>2026-01-22 21:04:40 +0100
commita6225807bbac6bb576eb582eddc8725f1ace24e5 (patch)
tree081e6aa22132ea7a91e68d55b45c6330022ff2e8
parent0b5582f699761ac3694b43aadaa0406431b14ea6 (diff)
Configure yay user (aur_builder) with passwordless access
-rw-r--r--roles/yay/tasks/main.yml30
1 files changed, 30 insertions, 0 deletions
diff --git a/roles/yay/tasks/main.yml b/roles/yay/tasks/main.yml
index b9d0ff5f..5759aa6c 100644
--- a/roles/yay/tasks/main.yml
+++ b/roles/yay/tasks/main.yml
@@ -35,3 +35,33 @@
cmd: "pacman -U --noconfirm /tmp/yay-bin/yay-bin-*.pkg.tar.zst"
args:
creates: "/usr/bin/yay"
+
+- name: "Configure yay aur_builder passwordless"
+ # yay builder is the user that is allowed to execute yay wihtout password
+ # to be able to use yay automation or archlinux
+ # Ref: https://github.com/kewlfft/ansible-aur?tab=readme-ov-file#usage
+ block:
+ - name: "Create the 'aur_builder' user"
+ become: true
+ ansible.builtin.user:
+ name: aur_builder
+ create_home: true
+ group: wheel
+
+ - name: "Allow 'username' to become 'aur_builder' user without a password"
+ become: true
+ ansible.builtin.lineinfile:
+ path: "/etc/sudoers.d/10-aur_builder-become"
+ line: "{{ username }} ALL=(aur_builder) NOPASSWD: ALL"
+ create: true
+ mode: "0644"
+ validate: "visudo -cf %s"
+
+ - name: "Allow the 'aur_builder' user to run 'sudo pacman' without a password"
+ become: true
+ ansible.builtin.lineinfile:
+ path: "/etc/sudoers.d/11-aur_builder-pacman"
+ line: "aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman"
+ create: true
+ mode: "0644"
+ validate: "visudo -cf %s"