chore: first commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
---
|
||||
- name: Check if paru is already installed
|
||||
stat:
|
||||
path: /usr/bin/paru
|
||||
register: paru
|
||||
|
||||
- name: Install paru
|
||||
block:
|
||||
- name: Install build dependencies
|
||||
package:
|
||||
name:
|
||||
- base-devel
|
||||
- git
|
||||
state: present
|
||||
|
||||
- name: Disable sudo password prompt (makepkg sudoers hack)
|
||||
lineinfile:
|
||||
dest: /etc/sudoers
|
||||
state: present
|
||||
regexp: "^#?%wheel"
|
||||
line: "%wheel ALL=(ALL) NOPASSWD: ALL"
|
||||
validate: /usr/sbin/visudo -cf %s
|
||||
|
||||
- command:
|
||||
cmd: whoami
|
||||
no_log: true
|
||||
become: false
|
||||
register: main_user
|
||||
|
||||
- set_fact:
|
||||
main_user: "{{ main_user.stdout }}"
|
||||
no_log: true
|
||||
|
||||
- name: Create paru sources dir
|
||||
file:
|
||||
path: "{{ paru_src_path }}"
|
||||
state: directory
|
||||
owner: "{{ main_user }}"
|
||||
|
||||
- name: Clone git sources
|
||||
become: false
|
||||
git:
|
||||
repo: "{{ paru_git_repo }}"
|
||||
dest: "{{ paru_src_path }}"
|
||||
|
||||
# note: this only works because SUDOERS password prompt is disabled
|
||||
- name: Build and install
|
||||
become: false
|
||||
command:
|
||||
chdir: "{{ paru_src_path }}"
|
||||
cmd: "makepkg -si -f --noconfirm"
|
||||
|
||||
- name: Restore sudo with password prompt
|
||||
lineinfile:
|
||||
dest: /etc/sudoers
|
||||
state: present
|
||||
regexp: "^#?%wheel"
|
||||
line: "%wheel ALL=(ALL:ALL) ALL"
|
||||
validate: /usr/sbin/visudo -cf %s
|
||||
when: not paru.stat.exists
|
||||
Reference in New Issue
Block a user