Compare commits

...

4 commits

Author SHA1 Message Date
c6f5d3546a tweaks for lint happiness 2024-11-22 13:32:30 -06:00
5d78efcac5 make dotfiles role lint happy 2024-11-22 10:51:40 -06:00
faa046aa21 ansible-lint --fix 2024-11-22 10:45:41 -06:00
5634cd32d3 add swaybg 2024-11-21 15:21:51 -06:00
23 changed files with 276 additions and 249 deletions

View file

@ -1,2 +1,3 @@
--- ---
- import_playbook: playbooks/install.yaml - name: OS Install
import_playbook: playbooks/install.yaml

View file

@ -1,6 +0,0 @@
- hosts: all
become: true
tasks:
- name: is this a livecd?
debug:
msg: "{{ ansible_nodename }} {{ ansible_nodename == 'archiso' }}"

View file

@ -1,10 +1,10 @@
--- ---
- name: detect archinso environment - name: Detect archinso environment
hosts: all hosts: all
roles: roles:
- detect_archiso - detect_archiso
- name: provision base archlinux installation - name: Provision base archlinux installation
hosts: base hosts: base
tags: base tags: base
roles: roles:

View file

@ -1,4 +1,5 @@
- name: post-install setup ---
- name: Post-install setup
hosts: base hosts: base
roles: roles:
- software - software

View file

@ -1,11 +1,13 @@
--- ---
- name: Inspect EFI boot partitions - name: Inspect EFI boot partitions
become: true become: true
command: "blkid {{ item }}" ansible.builtin.command: "blkid {{ item }}"
loop: "{{ base_efi_partitions | default([]) }}" loop: "{{ base_efi_partitions | default([]) }}"
register: blkid register: blkid
changed_when: false
- name: Format EFI partitions fat32 - name: Format EFI partitions fat32
command: "mkfs.vfat -v -F 32 -n EFI {{ item.item }}" ansible.builtin.command: "mkfs.vfat -v -F 32 -n EFI {{ item.item }}"
loop: "{{ blkid.results | rejectattr('stdout', 'contains', 'TYPE=\"vfat\"') }}" loop: "{{ blkid.results | rejectattr('stdout', 'contains', 'TYPE=\"vfat\"') }}"
register: mkfs_vfat_efi register: mkfs_vfat_efi
changed_when: true

View file

@ -0,0 +1,72 @@
---
- name: Root ZFS Pool | Check for existing zroot zfs volume
ansible.builtin.command: zpool list -Ho name zroot
register: zroot_check
changed_when: false
ignore_errors: true
- name: Root ZFS Pool |
when: zroot_check.rc != 0
block:
- name: Root ZFS Pool | initialize disk device to id table
ansible.builtin.set_fact:
partition_device_to_ids: {}
- name: Root ZFS Pool | create disk device -> id table
ansible.builtin.set_fact:
partition_device_to_ids: >-
{{
partition_device_to_ids
| combine({ item.value: (partition_device_to_ids[item.value] | default([])) + [item.key] })
}}
with_items: "{{ base_partitions_by_id | dict2items }}"
- name: Root ZFS Pool | create zroot volume
become: true
ansible.builtin.command: >-
zpool create -f -o ashift=12
-o autotrim=on
-O devices=off
-O relatime=on
-O xattr=sa
-O acltype=posixacl
-O normalization=formD
-O compression=lz4
-O canmount=off
-O mountpoint=none
-R /mnt
zroot {{ mirror }} {{ base_root_partitions | map('extract', partition_device_to_ids) | map('first') | list | join(' ') }}
vars:
mirror: "{{ 'mirror' if base_root_partitions | length > 1 else '' }}"
changed_when: true
- name: Root ZFS Pool | create zroot/ROOT and zroot/DATA volumes
community.general.zfs:
name: "zroot/{{ item }}"
state: present
register: zfs_zroot_root_volume
with_items: [ROOT, DATA]
- name: Root ZFS Pool | create zroot/ROOT/arch
community.general.zfs:
name: zroot/ROOT/arch
state: present
extra_zfs_properties:
canmount: noauto
mountpoint: /
when: zfs_zroot_root_volume.changed
- name: Root ZFS Pool | create zroot/DATA/home
community.general.zfs:
name: zroot/DATA/home
state: present
extra_zfs_properties:
mountpoint: /home
- name: Root ZFS Pool | Export zroot pool
ansible.builtin.command: zpool export zroot
changed_when: false
- name: Root ZFS Pool | Import zroot pool (-R /mnt)
ansible.builtin.command: zpool import -R /mnt zroot -N
changed_when: false

View file

@ -1,70 +0,0 @@
---
- name: Check for existing zroot zfs volume
command: zpool list -Ho name zroot
register: zroot_check
ignore_errors: true
- block:
- name: Initialize disk device to id table
set_fact:
partition_device_to_ids: {}
- name: Create disk device to id table
set_fact:
partition_device_to_ids: >-
{{
partition_device_to_ids
| combine({ item.value: (partition_device_to_ids[item.value] | default([])) + [item.key] })
}}
with_items: "{{ base_partitions_by_id | dict2items }}"
- debug:
var: base_root_partitions | map('extract', partition_device_to_ids) | map('first')
- name: Create zroot volume
become: true
command: >-
zpool create -f -o ashift=12
-o autotrim=on
-O devices=off
-O relatime=on
-O xattr=sa
-O acltype=posixacl
-O normalization=formD
-O compression=lz4
-O canmount=off
-O mountpoint=none
-R /mnt
zroot {{ mirror }} {{ base_root_partitions | map('extract', partition_device_to_ids) | map('first') | list | join(' ') }}
vars:
mirror: "{{ 'mirror' if base_root_partitions | length > 1 else '' }}"
when: zroot_check.rc != 0
- name: Create zroot/ROOT and zroot/DATA volumes
community.general.zfs:
name: "zroot/{{ item }}"
state: present
register: zfs_zroot_root_volume
with_items: [ROOT, DATA]
- name: Create zroot/ROOT/arch
community.general.zfs:
name: zroot/ROOT/arch
state: present
extra_zfs_properties:
canmount: noauto
mountpoint: /
when: zfs_zroot_root_volume.changed
- name: Create zroot/home
community.general.zfs:
name: zroot/DATA/home
state: present
extra_zfs_properties:
mountpoint: /home
- name: Export zroot pool
command: zpool export zroot
- name: Import zroot pool (-R /mnt)
command: zpool import -R /mnt zroot -N

View file

@ -1,12 +1,12 @@
--- ---
- name: Initialize swap space - name: Initialize swap space
become: true become: true
command: "blkid {{item}}" ansible.builtin.command: "blkid {{ item }}"
loop: "{{ base_swap_partitions | default([]) }}" loop: "{{ base_swap_partitions | default([]) }}"
register: blkid register: blkid
- name: Swap devices without swap filesystems present - name: Swap devices without swap filesystems present
become: true become: true
command: "mkswap --verbose {{item.item}}" ansible.builtin.command: "mkswap --verbose {{ item.item }}"
loop: "{{ blkid.results | rejectattr('stdout', 'contains', 'TYPE=\"swap\"') }}" loop: "{{ blkid.results | rejectattr('stdout', 'contains', 'TYPE=\"swap\"') }}"
register: mkswap register: mkswap

View file

@ -1,14 +1,14 @@
--- ---
- name: archinstall | install os | check for presence of previously pacstrapped /mnt - name: archinstall | install os | check for presence of previously pacstrapped /mnt
stat: ansible.builtin.stat:
path: /mnt/usr/lib path: /mnt/usr/lib
register: existing_pacstrap register: existing_pacstrap
- debug: - ansible.builtin.debug:
var: existing_pacstrap var: existing_pacstrap
- name: archinstall | install os | pacstrap - name: archinstall | install os | pacstrap
shell: "pacstrap /mnt {{ packages | join(' ') }}" ansible.builtin.command: "pacstrap /mnt {{ packages | join(' ') }}"
vars: vars:
packages: packages:
- ansible - ansible
@ -26,56 +26,54 @@
when: not existing_pacstrap.stat.exists when: not existing_pacstrap.stat.exists
- name: archinstall | install os | copy pacman mirrorlist - name: archinstall | install os | copy pacman mirrorlist
copy: ansible.builtin.copy:
remote_src: true remote_src: true
src: /etc/pacman.d/mirrorlist src: /etc/pacman.d/mirrorlist
dest: /mnt/etc/pacman.d/mirrorlist dest: /mnt/etc/pacman.d/mirrorlist
- name: archinstall | install os | propagate root authorized keys - name: archinstall | install os | propagate root authorized keys
copy: ansible.builtin.copy:
remote_src: true remote_src: true
src: /root/.ssh/authorized_keys src: /root/.ssh/authorized_keys
dest: /mnt/root/.ssh/authorized_keys dest: /mnt/root/.ssh/authorized_keys
- name: archinstall | install os | passwordless sudo for group wheel - name: archinstall | install os | passwordless sudo for group wheel
copy: ansible.builtin.copy:
content: "%wheel ALL=(ALL) NOPASSWD: ALL" content: "%wheel ALL=(ALL) NOPASSWD: ALL"
dest: /mnt/etc/sudoers.d/wheel-group-nopasswd dest: /mnt/etc/sudoers.d/wheel-group-nopasswd
- name: archinstall | install os | set timezone - name: archinstall | install os | set timezone
file: ansible.builtin.file:
src: /usr/share/zoneinfo/US/Central src: /usr/share/zoneinfo/US/Central
dest: /mnt/etc/localtime dest: /mnt/etc/localtime
state: link state: link
- name: archinstall | install os | enable en_US locales - name: archinstall | install os | enable en_US locales
command: sed -i 's/^#en_US/en_US/' /mnt/etc/locale.gen ansible.builtin.command: sed -i 's/^#en_US/en_US/' /mnt/etc/locale.gen
- name: archinstall | install os | generate locales - name: archinstall | install os | generate locales
command: arch-chroot /mnt locale-gen ansible.builtin.command: arch-chroot /mnt locale-gen
- name: archinstall | install os | generate template for arch-chroot installation - name: archinstall | install os | generate template for arch-chroot installation
template: ansible.builtin.template:
src: arch_chroot_install.sh src: arch_chroot_install.sh
dest: /mnt/arch_chroot_install.sh dest: /mnt/arch_chroot_install.sh
mode: "0755" mode: "0755"
- name: archinstall | install os | set hostname - name: archinstall | install os | set hostname
copy: ansible.builtin.copy:
dest: /mnt/etc/hostname dest: /mnt/etc/hostname
content: | content: |
{{ inventory_hostname }} {{ inventory_hostname }}
- name: archinstall | install os | run installation script in arch-chroot - name: archinstall | install os | run installation script in arch-chroot
command: arch-chroot /mnt /arch_chroot_install.sh ansible.builtin.command: arch-chroot /mnt /arch_chroot_install.sh
register: chroot register: chroot
- name: archinstall | install os | arch-chroot install output - name: archinstall | install os | arch-chroot install output
debug: ansible.builtin.debug:
msg: "{{ chroot.stdout_lines }}" msg: "{{ chroot.stdout_lines }}"
- name: archinstall | install os | remove arch-chroot installation script - name: archinstall | install os | remove arch-chroot installation script
file: ansible.builtin.file:
path: /mnt/arch_chroot_install.sh path: /mnt/arch_chroot_install.sh
state: absent state: absent

View file

@ -1,4 +1,4 @@
--- ---
- name: Select fastest Arch repository mirrors - name: Select fastest Arch repository mirrors
command: ansible.builtin.command:
cmd: reflector --country US --latest 5 --sort rate --save /etc/pacman.d/mirrorlist cmd: reflector --country US --latest 5 --sort rate --save /etc/pacman.d/mirrorlist

View file

@ -1,34 +1,28 @@
--- ---
- name: Get details about rootfs disks - name: Partition | get details about rootfs disks
community.general.parted: community.general.parted:
device: "{{ item }}" device: "{{ item }}"
unit: MiB unit: MiB
register: base_root_disks_info register: base_root_disks_info
loop: "{{ base_root_disks | list }}" loop: "{{ base_root_disks | list }}"
- name: partition | ensure efi is not mounted - name: Partition | calculate maximum usable disk space
mount:
path: /mnt/boot/efi
state: unmounted
- name: Calculate maximum usable disk space
ansible.builtin.set_fact: ansible.builtin.set_fact:
base_root_usable_mib: "{{ (base_root_disks_info.results | map(attribute='disk.size') | min | int) - 1 }}" base_root_usable_mib: "{{ (base_root_disks_info.results | map(attribute='disk.size') | min | int) - 1 }}"
- debug: var=base_root_usable_mib - name: Partition | calculate disk utilization percentage
- name: Calculate disk utilization percentage
ansible.builtin.set_fact: ansible.builtin.set_fact:
base_root_usable_mib: "{{ base_root_usable_mib|int - ((base_root_usable_mib|float) * (0.01 * (base_root_free_percent|float))) | round(method='floor') | int }}" base_root_usable_mib: "{{ base_root_usable_mib | int - ((base_root_usable_mib | float) * (0.01 * (base_root_free_percent | float))) | round(method='floor') |
int }}"
- name: Calculate zfs volume size - name: Partition | calculate zroot ZFS pool size
set_fact: ansible.builtin.set_fact:
base_root_zpool_mib: "{{ base_root_usable_mib|int - fixed_size_partitions|int }}" base_root_zpool_mib: "{{ base_root_usable_mib | int - fixed_size_partitions | int }}"
vars: vars:
fixed_size_partitions: "{{ base_root_swap_mib|int + base_root_efi_mib|int }}" fixed_size_partitions: "{{ base_root_swap_mib | int + base_root_efi_mib | int }}"
# #
- name: Calculate partition layouts - name: Partition | calculate partition layouts
set_fact: ansible.builtin.set_fact:
partition_ranges: >- partition_ranges: >-
{{ {{
(partition_ranges|d([])) + [{ (partition_ranges|d([])) + [{
@ -36,7 +30,7 @@
'end': partitions[:(loop_index|int+1)] | map(attribute='size_mib') | map('int') | sum(), 'end': partitions[:(loop_index|int+1)] | map(attribute='size_mib') | map('int') | sum(),
}] }]
}} }}
with_sequence: start=0 end="{{ partitions | length - 1}}" with_sequence: start=0 end="{{ partitions | length - 1 }}"
vars: vars:
loop_index: "{{ item }}" loop_index: "{{ item }}"
partitions: partitions:
@ -47,41 +41,44 @@
- name: swap - name: swap
size_mib: "{{ base_root_swap_mib }}" size_mib: "{{ base_root_swap_mib }}"
- debug: - name: Partition | initialize partitioning facts
var: partition_ranges ansible.builtin.set_fact:
- name: Initialize partition facts
set_fact:
base_efi_partitions: [] base_efi_partitions: []
base_root_partitions: [] base_root_partitions: []
base_swap_partitions: [] base_swap_partitions: []
- name: Partition | ensure efi is not mounted
ansible.posix.mount:
path: /mnt/boot/efi
state: unmounted
#### efi/boot #### efi/boot
- name: Create EFI partition - name: Partition | create EFI boot partition
become: true become: true
vars: vars:
part_index: 0 part_index: 0
parted: community.general.parted:
label: gpt label: gpt
unit: MiB unit: MiB
name: EFI Boot name: EFI Boot
device: "{{ item.disk.dev }}" device: "{{ item.disk.dev }}"
number: "{{ part_index + 1 }}" number: "{{ part_index + 1 }}"
flags: [ boot, esp ] flags: [boot, esp]
part_start: "{{ [partition_ranges[part_index].begin, 1]|max }}MiB" part_start: "{{ [partition_ranges[part_index].begin, 1] | max }}MiB"
part_end: "{{ partition_ranges[part_index].end }}MiB" part_end: "{{ partition_ranges[part_index].end }}MiB"
state: present state: present
fs_type: fat32 fs_type: fat32
loop: "{{ base_root_disks_info.results }}" loop: "{{ base_root_disks_info.results }}"
register: parted_create register: parted_create
- name: Collect EFI partition devices - name: Partition | collect EFI boot partition devices
shell: "lsblk -r --noheadings -o PATH {{ item }} | sort" ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
register: lsblk register: lsblk
loop: "{{ parted_create.results | map(attribute='disk.dev') }}" loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
changed_when: false
- name: Store EFI partition devices - name: Store EFI partition devices
set_fact: ansible.builtin.set_fact:
base_efi_partitions: >- base_efi_partitions: >-
{{ base_efi_partitions|d([]) + [ {{ base_efi_partitions|d([]) + [
item[part_index+1] item[part_index+1]
@ -90,15 +87,14 @@
loop: "{{ lsblk.results | map(attribute='stdout_lines') | sort }}" loop: "{{ lsblk.results | map(attribute='stdout_lines') | sort }}"
vars: vars:
part_index: 0 part_index: 0
changed_when: false
- debug: var=base_efi_partitions #### zroot zfs pool
- name: Partition | create root ZFS pool partition
#### zroot
- name: Create root zvol partition
become: true become: true
vars: vars:
part_index: 1 part_index: 1
parted: community.general.parted:
label: gpt label: gpt
unit: MiB unit: MiB
name: ArchLinux ZFS Root name: ArchLinux ZFS Root
@ -110,13 +106,14 @@
loop: "{{ parted_create.results }}" loop: "{{ parted_create.results }}"
register: parted_create register: parted_create
- name: Collect root zvol partition devices - name: Partition | collect root ZFS pool partition devices
shell: "lsblk -r --noheadings -o PATH {{ item }} | sort" ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
register: lsblk register: lsblk
loop: "{{ parted_create.results | map(attribute='disk.dev') }}" loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
changed_when: false
- name: Store root zvol partition devices - name: Partition | store root ZFS pool partition devices
set_fact: ansible.builtin.set_fact:
base_root_partitions: >- base_root_partitions: >-
{{ base_root_partitions|d([]) + [ {{ base_root_partitions|d([]) + [
item[part_index+1] item[part_index+1]
@ -125,13 +122,14 @@
loop: "{{ lsblk.results | map(attribute='stdout_lines') | sort }}" loop: "{{ lsblk.results | map(attribute='stdout_lines') | sort }}"
vars: vars:
part_index: 1 part_index: 1
changed_when: false
#### swap #### swap partitions
- name: Create swap partition - name: Partition | create swap partition
become: true become: true
vars: vars:
part_index: 2 part_index: 2
parted: community.general.parted:
label: gpt label: gpt
unit: MiB unit: MiB
device: "{{ item.disk.dev }}" device: "{{ item.disk.dev }}"
@ -144,14 +142,15 @@
register: parted_create register: parted_create
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0 when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
- name: Collect swap partition devices - name: Partition | Collect swap partition devices
shell: "lsblk -r --noheadings -o PATH {{ item }} | sort" ansible.builtin.shell: "set -o pipefail; lsblk -r --noheadings -o PATH {{ item }} | sort"
register: lsblk register: lsblk
loop: "{{ parted_create.results | map(attribute='disk.dev') }}" loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0 when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
changed_when: false
- name: Store swap partition devices - name: Partition | Store swap partition devices
set_fact: ansible.builtin.set_fact:
base_swap_partitions: >- base_swap_partitions: >-
{{ base_swap_partitions|d([]) + [ {{ base_swap_partitions|d([]) + [
item[part_index+1] item[part_index+1]
@ -161,20 +160,22 @@
vars: vars:
part_index: 2 part_index: 2
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0 when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
changed_when: false
- name: Analyze resulting partition layouts - name: Partition | Analyze resulting partition layouts
parted: community.general.parted:
unit: MiB unit: MiB
device: "{{ item }}" device: "{{ item }}"
register: base_root_disks_info register: base_root_disks_info
loop: "{{ base_root_disks | list }}" loop: "{{ base_root_disks | list }}"
- name: Collect disk device identifiers - name: Partition | Collect disk device identifiers
shell: "for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done" ansible.builtin.shell: "set -o pipefail; for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done"
register: disk_realpaths register: disk_realpaths
changed_when: false
- name: Collect disk device identifiers into a base_partitions_by_id dictionary - name: Partition | Collect disk device identifiers into a base_partitions_by_id dictionary
set_fact: ansible.builtin.set_fact:
base_partitions_by_id: >- base_partitions_by_id: >-
{{ {{
dict( dict(
@ -183,7 +184,3 @@
| map('list') | map('list')
) )
}} }}
- debug: var=base_efi_partitions
- debug: var=base_root_partitions
- debug: var=base_swap_partitions

View file

@ -1,10 +1,11 @@
- name: archinstall | re-create post-installation snapshot of zroot/ROOT/arch ---
- name: archinstall | Re-create post-installation snapshot of zroot/ROOT/arch
community.general.zfs: community.general.zfs:
name: zroot/ROOT/arch@post-installation name: zroot/ROOT/arch@post-installation
state: "{{ item }}" state: "{{ item }}"
with_items: [absent, present] with_items: [absent, present]
- name: archinstall | re-create post-installation snapshot of zroot/DATA/home - name: archinstall | Re-create post-installation snapshot of zroot/DATA/home
community.general.zfs: community.general.zfs:
name: zroot/DATA/home@post-installation name: zroot/DATA/home@post-installation
state: "{{ item }}" state: "{{ item }}"

View file

@ -1,20 +1,23 @@
--- ---
- name: Mount arch zroot - name: Arch Install | Chroot | Mount arch zroot
command: zfs mount zroot/ROOT/arch ansible.builtin.command: zfs mount zroot/ROOT/arch
changed_when: false
- name: Mount all other zroot mountpoints - name: Arch Install | Chroot | Mount all other zroot mountpoints
command: zfs mount -a ansible.builtin.command: zfs mount -a
changed_when: false
- name: Create zroot destination directories - name: Arch Install | Chroot | Create zroot destination directories
ansible.builtin.file: ansible.builtin.file:
path: "/mnt{{ item }}" path: "/mnt{{ item }}"
state: directory state: directory
owner: root
group: root
mode: '0755'
loop: loop:
- /etc/zfs - /etc/zfs
- /boot/efi - /boot/efi
- debug: var=base_efi_partitions
- name: Mount EFI - name: Mount EFI
ansible.posix.mount: ansible.posix.mount:
path: /mnt/boot/efi path: /mnt/boot/efi
@ -22,11 +25,19 @@
fstype: vfat fstype: vfat
state: mounted state: mounted
- name: zfs | set zroot bootfs to arch - name: Arch Chroot | zpool | Set zroot bootfs to arch
command: zpool set bootfs=zroot/ROOT/arch zroot ansible.builtin.command: zpool set bootfs=zroot/ROOT/arch zroot
changed_when: false
- name: zfs | set cachefile - name: Arch Chroot | zpool | Set cachefile
command: zpool set cachefile=/etc/zfs/zpool.cache zroot ansible.builtin.command: zpool set cachefile=/etc/zfs/zpool.cache zroot
changed_when: false
- name: zfs | copy cache file to chroot - name: Arch Chroot | zpool | copy zpool.cache to installation chroot
command: cp /etc/zfs/zpool.cache /mnt/etc/zfs ansible.builtin.copy:
remote_src: true
src: /etc/zfs/zpool.cache
dest: /mnt/etc/zfs/zpool.cache
owner: root
group: root
mode: "0644"

View file

@ -1,15 +1,15 @@
--- ---
- block: - when: archiso_detected and base_root_disks is defined
- name: ensure root_password is set block:
assert: - name: Ensure root_password is set
that: root_password is defined ansible.builtin.assert:
msg: "please specify a root password via -e root_password=<password>" that: root_password is defined
- import_tasks: archinstall/mirrorlist.yaml msg: "please specify a root password via -e root_password=<password>"
- import_tasks: archinstall/partition.yaml - ansible.builtin.import_tasks: archinstall/mirrorlist.yaml
- import_tasks: archinstall/initialize_root_zvol.yaml - ansible.builtin.import_tasks: archinstall/partition.yaml
- import_tasks: archinstall/initialize_swap.yaml - ansible.builtin.import_tasks: archinstall/initialize_root_zfs_pool.yaml
- import_tasks: archinstall/initialize_efi.yaml - ansible.builtin.import_tasks: archinstall/initialize_swap.yaml
- import_tasks: archinstall/prepare_chroot.yaml - ansible.builtin.import_tasks: archinstall/initialize_efi.yaml
- import_tasks: archinstall/install_os.yaml - ansible.builtin.import_tasks: archinstall/prepare_chroot.yaml
- import_tasks: archinstall/postinstall_snapshot.yaml - ansible.builtin.import_tasks: archinstall/install_os.yaml
when: archiso_detected and base_root_disks is defined - ansible.builtin.import_tasks: archinstall/postinstall_snapshot.yaml

View file

@ -1,9 +1,10 @@
--- ---
- name: check for archinstall in path - name: Check for archinstall in path
command: which archinstall ansible.builtin.command: which archinstall
changed_when: false
ignore_errors: true ignore_errors: true
register: which_archinstall register: which_archinstall
- name: inspect archinstall check result - name: Inspect archinstall check result
set_fact: ansible.builtin.set_fact:
archiso_detected: "{{ which_archinstall.rc == 0 }}" archiso_detected: "{{ which_archinstall.rc == 0 }}"

View file

@ -1,13 +1,13 @@
--- ---
- name: dotfiles | set user shell - name: Dotfiles | set user shell
ansible.builtin.user: ansible.builtin.user:
name: "{{ dotfiles_user }}" name: "{{ dotfiles_user }}"
shell: "/usr/bin/{{ dotfiles_shell }}" shell: "/usr/bin/{{ dotfiles_shell }}"
- name: dotfiles | install from remote source - name: Dotfiles | install from remote source
become: true become: true
become_user: "{{ dotfiles_user }}" become_user: "{{ dotfiles_user }}"
shell: ansible.builtin.shell:
cmd: "curl -o- -L {{ dotfiles_url }} | {{ dotfiles_shell }}" cmd: "set -o pipefail; curl -o- -L {{ dotfiles_url }} | {{ dotfiles_shell }}"
creates: "/home/{{ dotfiles_user }}/.dotfiles" creates: "/home/{{ dotfiles_user }}/.dotfiles"
register: dotfiles register: dotfiles

View file

@ -1 +1,2 @@
desktop_user: mark ---
software_desktop_user: mark

View file

@ -1,12 +1,17 @@
--- ---
- block: - name: Install system package groups
- name: pacman sync
community.general.pacman:
update_cache: true
- import_tasks: software/minimal.yaml
- import_tasks: software/desktop.yaml
- import_tasks: software/graphics.yaml
- import_tasks: software/dev.yaml
- import_tasks: software/gamedev.yaml
when: not archiso_detected when: not archiso_detected
block:
- name: Update pacman cache
community.general.pacman:
update_cache: true
- name: Minimal
ansible.builtin.import_tasks: software/minimal.yaml
- name: Desktop
ansible.builtin.import_tasks: software/desktop.yaml
- name: Graphics
ansible.builtin.import_tasks: software/graphics.yaml
- name: Development
ansible.builtin.import_tasks: software/dev.yaml
- name: Game Development
ansible.builtin.import_tasks: software/gamedev.yaml

View file

@ -1,5 +1,6 @@
- name: install desktop packages ---
package: - name: Install desktop packages
ansible.builtin.package:
state: present state: present
name: name:
- adwaita-cursors - adwaita-cursors
@ -24,6 +25,7 @@
- solaar - solaar
- swappy - swappy
- sway - sway
- swaybg
- syncthing - syncthing
- telegram-desktop - telegram-desktop
- thunar - thunar
@ -35,70 +37,77 @@
- xdg-user-dirs - xdg-user-dirs
- xorg-xwayland - xorg-xwayland
- name: install AUR packages - name: Install AUR packages
become: true become: true
become_user: "{{ desktop_user }}" become_user: "{{ software_desktop_user }}"
shell: >- ansible.builtin.command: >-
paru -Sy --needed --noconfirm {{ packages | join(' ') }} paru -Sy --needed --noconfirm {{ packages | join(' ') }}
changed_when: true
vars: vars:
packages: packages:
- dracula-gtk-theme-full - dracula-gtk-theme-full
- ttf-envy-code-r - ttf-envy-code-r
- winbox - winbox
- name: loginctl | enable linger for desktop user - name: Enable linger for desktop user
command: "loginctl enable-linger {{ desktop_user }}" ansible.builtin.command:
cmd: "loginctl enable-linger {{ software_desktop_user }}"
creates: "/var/lib/systemd/linger/{{ software_desktop_user }}"
- name: syncthing | generate default config - name: Syncthing | Generate default config
become: yes become: true
become_user: "{{ desktop_user }}" become_user: "{{ software_desktop_user }}"
command: >- ansible.builtin.command:
syncthing generate --no-default-folder --skip-port-probing cmd: syncthing generate --no-default-folder --skip-port-probing
creates: "/home/{{ software_deskop_user }}/.local/state/syncthing/config.xml"
- name: syncthing | enable user systemd unit - name: Syncthing | Enable user systemd unit
systemd: ansible.builtin.systemd:
name: syncthing.service name: syncthing.service
enabled: true enabled: true
state: started state: started
scope: user scope: user
become: true become: true
become_user: "{{ desktop_user }}" become_user: "{{ software_desktop_user }}"
- name: greetd | configure | use tuigreet - name: Greetd | configure | use tuigreet
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/greetd/config.toml path: /etc/greetd/config.toml
regexp: '^command =' regexp: "^command ="
line: command = "tuigreet --cmd sway" line: command = "tuigreet --cmd sway"
- name: greetd | enable systemd unit - name: Greetd | Enable systemd unit
systemd: ansible.builtin.systemd:
name: greetd name: greetd
enabled: true enabled: true
- name: bluetooth | enable systemd unit - name: Bluetooth | Enable systemd unit
systemd: ansible.builtin.systemd:
name: bluetooth name: bluetooth
enabled: true enabled: true
- name: wal | set initial colorscheme - name: Wal | Set initial colorscheme
become: true become: true
become_user: "{{ desktop_user }}" become_user: "{{ software_desktop_user }}"
shell: wal --theme hybrid-material ansible.builtin.command: wal --theme hybrid-material
changed_when: false
- name: sway | reload if running - name: Sway | Reload if running
become: true become: true
become_user: "{{ desktop_user }}" become_user: "{{ software_desktop_user }}"
shell: pidof sway && SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) swaymsg reload ansible.builtin.shell: set -o pipefail; pidof sway && SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) swaymsg reload
ignore_errors: true failed_when: false
changed_when: false
- name: graphics | probe for graphics cards - name: Graphics | Probe for graphics cards
shell: lspci -nnk | grep -A 3 -E "VGA|3D" ansible.builtin.shell: set -o pipefail; lspci -nnk | grep -A 3 -E "VGA|3D"
register: lspci register: lspci
changed_when: false
- name: graphics | install radeon specific packages - name: Graphics | Install radeon specific packages
package: ansible.builtin.package:
state: present state: present
name: name:
- hip-runtime-amd - hip-runtime-amd
- rocm-opencl-runtime - rocm-opencl-runtime
- vulkan-radeon - vulkan-radeon

View file

@ -1,5 +1,6 @@
- name: install gamedev packages ---
package: - name: Install gamedev packages
ansible.builtin.package:
state: present state: present
name: name:
- neovim - neovim

View file

@ -1,5 +1,6 @@
- name: install gamedev packages ---
package: - name: Install gamedev packages
ansible.builtin.package:
state: present state: present
name: name:
- godot - godot

View file

@ -1,5 +1,6 @@
- name: install graphics packages ---
package: - name: Install graphics packages
ansible.builtin.package:
state: present state: present
name: name:
- blender - blender

View file

@ -1,10 +1,11 @@
- name: install minimal packages ---
package: - name: Install minimal packages
ansible.builtin.package:
state: present state: present
name: name:
- eza - eza
- fzf - fzf
- htop - htop
- ripgrep - ripgrep
- zip - unzip
- zsh - zsh