Compare commits

..

No commits in common. "c6f5d3546aced573b5ae7c756f11c24095bfedcd" and "fda86605155778231d6138a55b9d56ecb2a7f539" have entirely different histories.

23 changed files with 249 additions and 276 deletions

View file

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

6
playbooks/info.yaml Normal file
View file

@ -0,0 +1,6 @@
- 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,5 +1,4 @@
--- - name: post-install setup
- name: Post-install setup
hosts: base hosts: base
roles: roles:
- software - software

View file

@ -1,13 +1,11 @@
--- ---
- name: Inspect EFI boot partitions - name: Inspect EFI boot partitions
become: true become: true
ansible.builtin.command: "blkid {{ item }}" 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
ansible.builtin.command: "mkfs.vfat -v -F 32 -n EFI {{ item.item }}" 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

@ -1,72 +0,0 @@
---
- 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

@ -0,0 +1,70 @@
---
- 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
ansible.builtin.command: "blkid {{ item }}" 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
ansible.builtin.command: "mkswap --verbose {{ item.item }}" 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
ansible.builtin.stat: stat:
path: /mnt/usr/lib path: /mnt/usr/lib
register: existing_pacstrap register: existing_pacstrap
- ansible.builtin.debug: - debug:
var: existing_pacstrap var: existing_pacstrap
- name: archinstall | install os | pacstrap - name: archinstall | install os | pacstrap
ansible.builtin.command: "pacstrap /mnt {{ packages | join(' ') }}" shell: "pacstrap /mnt {{ packages | join(' ') }}"
vars: vars:
packages: packages:
- ansible - ansible
@ -26,54 +26,56 @@
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
ansible.builtin.copy: 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
ansible.builtin.copy: 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
ansible.builtin.copy: 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
ansible.builtin.file: 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
ansible.builtin.command: sed -i 's/^#en_US/en_US/' /mnt/etc/locale.gen command: sed -i 's/^#en_US/en_US/' /mnt/etc/locale.gen
- name: archinstall | install os | generate locales - name: archinstall | install os | generate locales
ansible.builtin.command: arch-chroot /mnt locale-gen 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
ansible.builtin.template: 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
ansible.builtin.copy: 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
ansible.builtin.command: arch-chroot /mnt /arch_chroot_install.sh 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
ansible.builtin.debug: 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
ansible.builtin.file: 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
ansible.builtin.command: 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,28 +1,34 @@
--- ---
- name: Partition | get details about rootfs disks - name: 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 | calculate maximum usable disk space - name: partition | ensure efi is not mounted
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 }}"
- name: Partition | calculate disk utilization percentage - debug: var=base_root_usable_mib
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 }}"
- name: Partition | calculate zroot ZFS pool size - name: Calculate disk utilization percentage
ansible.builtin.set_fact: ansible.builtin.set_fact:
base_root_zpool_mib: "{{ base_root_usable_mib | int - fixed_size_partitions | 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
set_fact:
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: Partition | calculate partition layouts - name: Calculate partition layouts
ansible.builtin.set_fact: set_fact:
partition_ranges: >- partition_ranges: >-
{{ {{
(partition_ranges|d([])) + [{ (partition_ranges|d([])) + [{
@ -30,7 +36,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:
@ -41,44 +47,41 @@
- name: swap - name: swap
size_mib: "{{ base_root_swap_mib }}" size_mib: "{{ base_root_swap_mib }}"
- name: Partition | initialize partitioning facts - debug:
ansible.builtin.set_fact: var: partition_ranges
- 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: Partition | create EFI boot partition - name: Create EFI partition
become: true become: true
vars: vars:
part_index: 0 part_index: 0
community.general.parted: 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: Partition | collect EFI boot partition devices - name: Collect EFI partition devices
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort" 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
ansible.builtin.set_fact: set_fact:
base_efi_partitions: >- base_efi_partitions: >-
{{ base_efi_partitions|d([]) + [ {{ base_efi_partitions|d([]) + [
item[part_index+1] item[part_index+1]
@ -87,14 +90,15 @@
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
#### zroot zfs pool - debug: var=base_efi_partitions
- 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
community.general.parted: parted:
label: gpt label: gpt
unit: MiB unit: MiB
name: ArchLinux ZFS Root name: ArchLinux ZFS Root
@ -106,14 +110,13 @@
loop: "{{ parted_create.results }}" loop: "{{ parted_create.results }}"
register: parted_create register: parted_create
- name: Partition | collect root ZFS pool partition devices - name: Collect root zvol partition devices
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort" 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: Partition | store root ZFS pool partition devices - name: Store root zvol partition devices
ansible.builtin.set_fact: set_fact:
base_root_partitions: >- base_root_partitions: >-
{{ base_root_partitions|d([]) + [ {{ base_root_partitions|d([]) + [
item[part_index+1] item[part_index+1]
@ -122,14 +125,13 @@
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 partitions #### swap
- name: Partition | create swap partition - name: Create swap partition
become: true become: true
vars: vars:
part_index: 2 part_index: 2
community.general.parted: parted:
label: gpt label: gpt
unit: MiB unit: MiB
device: "{{ item.disk.dev }}" device: "{{ item.disk.dev }}"
@ -142,15 +144,14 @@
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: Partition | Collect swap partition devices - name: Collect swap partition devices
ansible.builtin.shell: "set -o pipefail; lsblk -r --noheadings -o PATH {{ item }} | sort" 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') }}"
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: Partition | Store swap partition devices - name: Store swap partition devices
ansible.builtin.set_fact: set_fact:
base_swap_partitions: >- base_swap_partitions: >-
{{ base_swap_partitions|d([]) + [ {{ base_swap_partitions|d([]) + [
item[part_index+1] item[part_index+1]
@ -160,22 +161,20 @@
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: Partition | Analyze resulting partition layouts - name: Analyze resulting partition layouts
community.general.parted: 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: Partition | Collect disk device identifiers - name: Collect disk device identifiers
ansible.builtin.shell: "set -o pipefail; for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done" shell: "for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done"
register: disk_realpaths register: disk_realpaths
changed_when: false
- name: Partition | Collect disk device identifiers into a base_partitions_by_id dictionary - name: Collect disk device identifiers into a base_partitions_by_id dictionary
ansible.builtin.set_fact: set_fact:
base_partitions_by_id: >- base_partitions_by_id: >-
{{ {{
dict( dict(
@ -184,3 +183,7 @@
| map('list') | map('list')
) )
}} }}
- debug: var=base_efi_partitions
- debug: var=base_root_partitions
- debug: var=base_swap_partitions

View file

@ -1,11 +1,10 @@
--- - 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,23 +1,20 @@
--- ---
- name: Arch Install | Chroot | Mount arch zroot - name: Mount arch zroot
ansible.builtin.command: zfs mount zroot/ROOT/arch command: zfs mount zroot/ROOT/arch
changed_when: false
- name: Arch Install | Chroot | Mount all other zroot mountpoints - name: Mount all other zroot mountpoints
ansible.builtin.command: zfs mount -a command: zfs mount -a
changed_when: false
- name: Arch Install | Chroot | Create zroot destination directories - name: 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
@ -25,19 +22,11 @@
fstype: vfat fstype: vfat
state: mounted state: mounted
- name: Arch Chroot | zpool | Set zroot bootfs to arch - name: zfs | set zroot bootfs to arch
ansible.builtin.command: zpool set bootfs=zroot/ROOT/arch zroot command: zpool set bootfs=zroot/ROOT/arch zroot
changed_when: false
- name: Arch Chroot | zpool | Set cachefile - name: zfs | set cachefile
ansible.builtin.command: zpool set cachefile=/etc/zfs/zpool.cache zroot command: zpool set cachefile=/etc/zfs/zpool.cache zroot
changed_when: false
- name: Arch Chroot | zpool | copy zpool.cache to installation chroot - name: zfs | copy cache file to chroot
ansible.builtin.copy: command: cp /etc/zfs/zpool.cache /mnt/etc/zfs
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 @@
--- ---
- when: archiso_detected and base_root_disks is defined - block:
block: - name: ensure root_password is set
- name: Ensure root_password is set assert:
ansible.builtin.assert: that: root_password is defined
that: root_password is defined msg: "please specify a root password via -e root_password=<password>"
msg: "please specify a root password via -e root_password=<password>" - import_tasks: archinstall/mirrorlist.yaml
- ansible.builtin.import_tasks: archinstall/mirrorlist.yaml - import_tasks: archinstall/partition.yaml
- ansible.builtin.import_tasks: archinstall/partition.yaml - import_tasks: archinstall/initialize_root_zvol.yaml
- ansible.builtin.import_tasks: archinstall/initialize_root_zfs_pool.yaml - import_tasks: archinstall/initialize_swap.yaml
- ansible.builtin.import_tasks: archinstall/initialize_swap.yaml - import_tasks: archinstall/initialize_efi.yaml
- ansible.builtin.import_tasks: archinstall/initialize_efi.yaml - import_tasks: archinstall/prepare_chroot.yaml
- ansible.builtin.import_tasks: archinstall/prepare_chroot.yaml - import_tasks: archinstall/install_os.yaml
- ansible.builtin.import_tasks: archinstall/install_os.yaml - import_tasks: archinstall/postinstall_snapshot.yaml
- ansible.builtin.import_tasks: archinstall/postinstall_snapshot.yaml when: archiso_detected and base_root_disks is defined

View file

@ -1,10 +1,9 @@
--- ---
- name: Check for archinstall in path - name: check for archinstall in path
ansible.builtin.command: which archinstall 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
ansible.builtin.set_fact: 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 }}"
ansible.builtin.shell: shell:
cmd: "set -o pipefail; curl -o- -L {{ dotfiles_url }} | {{ dotfiles_shell }}" cmd: "curl -o- -L {{ dotfiles_url }} | {{ dotfiles_shell }}"
creates: "/home/{{ dotfiles_user }}/.dotfiles" creates: "/home/{{ dotfiles_user }}/.dotfiles"
register: dotfiles register: dotfiles

View file

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

View file

@ -1,17 +1,12 @@
--- ---
- name: Install system package groups - block:
- 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,6 +1,5 @@
--- - name: install desktop packages
- name: Install desktop packages package:
ansible.builtin.package:
state: present state: present
name: name:
- adwaita-cursors - adwaita-cursors
@ -25,7 +24,6 @@
- solaar - solaar
- swappy - swappy
- sway - sway
- swaybg
- syncthing - syncthing
- telegram-desktop - telegram-desktop
- thunar - thunar
@ -37,77 +35,70 @@
- xdg-user-dirs - xdg-user-dirs
- xorg-xwayland - xorg-xwayland
- name: Install AUR packages - name: install AUR packages
become: true become: true
become_user: "{{ software_desktop_user }}" become_user: "{{ desktop_user }}"
ansible.builtin.command: >- shell: >-
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: Enable linger for desktop user - name: loginctl | enable linger for desktop user
ansible.builtin.command: command: "loginctl enable-linger {{ desktop_user }}"
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: true become: yes
become_user: "{{ software_desktop_user }}" become_user: "{{ desktop_user }}"
ansible.builtin.command: command: >-
cmd: syncthing generate --no-default-folder --skip-port-probing 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
ansible.builtin.systemd: 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: "{{ software_desktop_user }}" become_user: "{{ 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
ansible.builtin.systemd: systemd:
name: greetd name: greetd
enabled: true enabled: true
- name: Bluetooth | Enable systemd unit - name: bluetooth | enable systemd unit
ansible.builtin.systemd: 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: "{{ software_desktop_user }}" become_user: "{{ desktop_user }}"
ansible.builtin.command: wal --theme hybrid-material shell: wal --theme hybrid-material
changed_when: false
- name: Sway | Reload if running - name: sway | reload if running
become: true become: true
become_user: "{{ software_desktop_user }}" become_user: "{{ desktop_user }}"
ansible.builtin.shell: set -o pipefail; pidof sway && SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) swaymsg reload shell: pidof sway && SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) swaymsg reload
failed_when: false ignore_errors: true
changed_when: false
- name: Graphics | Probe for graphics cards - name: graphics | probe for graphics cards
ansible.builtin.shell: set -o pipefail; lspci -nnk | grep -A 3 -E "VGA|3D" shell: 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
ansible.builtin.package: 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,6 +1,5 @@
--- - name: install gamedev packages
- name: Install gamedev packages package:
ansible.builtin.package:
state: present state: present
name: name:
- neovim - neovim

View file

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

View file

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

View file

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