chore: first commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
---
|
||||
- name: Configure locales
|
||||
block:
|
||||
- name: activate locale
|
||||
command:
|
||||
cmd: localectl set-locale LANG={{ arch_locale }}
|
||||
- name: edit /etc/locale.gen
|
||||
lineinfile:
|
||||
dest: /etc/locale.gen
|
||||
state: present
|
||||
regexp: "{{ arch_locale }}"
|
||||
line: "{{ arch_locale }} UTF-8"
|
||||
- name: regenerate locales
|
||||
command:
|
||||
cmd: locale-gen
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Skip Archlinux installation
|
||||
meta: end_play
|
||||
when: ansible_facts['os_family'] != 'Archlinux'
|
||||
|
||||
- name: Archlinux base setup
|
||||
include_tasks: "{{ item }}"
|
||||
loop:
|
||||
- pacman.yml
|
||||
- locales.yml
|
||||
- yay.yml
|
||||
- paru.yml
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
- name: Check if yay is already installed
|
||||
stat:
|
||||
path: /usr/bin/yay
|
||||
register: yay
|
||||
|
||||
- name: Install yay
|
||||
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 yay sources dir
|
||||
file:
|
||||
path: "{{ yay_src_path }}"
|
||||
state: directory
|
||||
owner: "{{ main_user }}"
|
||||
|
||||
- name: Clone git sources
|
||||
become: false
|
||||
git:
|
||||
repo: "{{ yay_git_repo }}"
|
||||
dest: "{{ yay_src_path }}"
|
||||
|
||||
# note: this only works because SUDOERS password prompt is disabled
|
||||
- name: Build and install
|
||||
become: false
|
||||
command:
|
||||
chdir: "{{ yay_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 yay.stat.exists
|
||||
Reference in New Issue
Block a user