tweaks for lint happiness
This commit is contained in:
parent
5d78efcac5
commit
c6f5d3546a
12 changed files with 128 additions and 104 deletions
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- import_playbook: playbooks/install.yaml
|
||||
- name: OS Install
|
||||
import_playbook: playbooks/install.yaml
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: Is this a livecd?
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ ansible_nodename }} {{ ansible_nodename == 'archiso' }}"
|
|
@ -4,8 +4,10 @@
|
|||
ansible.builtin.command: "blkid {{ item }}"
|
||||
loop: "{{ base_efi_partitions | default([]) }}"
|
||||
register: blkid
|
||||
changed_when: false
|
||||
|
||||
- name: Format EFI partitions fat32
|
||||
ansible.builtin.command: "mkfs.vfat -v -F 32 -n EFI {{ item.item }}"
|
||||
loop: "{{ blkid.results | rejectattr('stdout', 'contains', 'TYPE=\"vfat\"') }}"
|
||||
register: mkfs_vfat_efi
|
||||
changed_when: true
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
---
|
||||
- name: Check for existing zroot zfs volume
|
||||
- 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
|
||||
|
||||
- when: zroot_check.rc != 0
|
||||
|
||||
- name: Root ZFS Pool |
|
||||
when: zroot_check.rc != 0
|
||||
block:
|
||||
- name: Initialize disk device to id table
|
||||
- name: Root ZFS Pool | initialize disk device to id table
|
||||
ansible.builtin.set_fact:
|
||||
partition_device_to_ids: {}
|
||||
|
||||
- name: Create disk device to id table
|
||||
- name: Root ZFS Pool | create disk device -> id table
|
||||
ansible.builtin.set_fact:
|
||||
partition_device_to_ids: >-
|
||||
{{
|
||||
|
@ -20,10 +21,7 @@
|
|||
}}
|
||||
with_items: "{{ base_partitions_by_id | dict2items }}"
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: base_root_partitions | map('extract', partition_device_to_ids) | map('first')
|
||||
|
||||
- name: Create zroot volume
|
||||
- name: Root ZFS Pool | create zroot volume
|
||||
become: true
|
||||
ansible.builtin.command: >-
|
||||
zpool create -f -o ashift=12
|
||||
|
@ -40,14 +38,16 @@
|
|||
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 '' }}"
|
||||
- name: Create zroot/ROOT and zroot/DATA volumes
|
||||
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: Create zroot/ROOT/arch
|
||||
- name: Root ZFS Pool | create zroot/ROOT/arch
|
||||
community.general.zfs:
|
||||
name: zroot/ROOT/arch
|
||||
state: present
|
||||
|
@ -56,14 +56,17 @@
|
|||
mountpoint: /
|
||||
when: zfs_zroot_root_volume.changed
|
||||
|
||||
- name: Create zroot/home
|
||||
- name: Root ZFS Pool | create zroot/DATA/home
|
||||
community.general.zfs:
|
||||
name: zroot/DATA/home
|
||||
state: present
|
||||
extra_zfs_properties:
|
||||
mountpoint: /home
|
||||
|
||||
- name: Export zroot pool
|
||||
- name: Root ZFS Pool | Export zroot pool
|
||||
ansible.builtin.command: zpool export zroot
|
||||
- name: Import zroot pool (-R /mnt)
|
||||
changed_when: false
|
||||
|
||||
- name: Root ZFS Pool | Import zroot pool (-R /mnt)
|
||||
ansible.builtin.command: zpool import -R /mnt zroot -N
|
||||
changed_when: false
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
- name: Initialize swap space
|
||||
become: true
|
||||
ansible.builtin.command: "blkid {{item}}"
|
||||
ansible.builtin.command: "blkid {{ item }}"
|
||||
loop: "{{ base_swap_partitions | default([]) }}"
|
||||
register: blkid
|
||||
|
||||
- name: Swap devices without swap filesystems present
|
||||
become: true
|
||||
ansible.builtin.command: "mkswap --verbose {{item.item}}"
|
||||
ansible.builtin.command: "mkswap --verbose {{ item.item }}"
|
||||
loop: "{{ blkid.results | rejectattr('stdout', 'contains', 'TYPE=\"swap\"') }}"
|
||||
register: mkswap
|
||||
|
|
|
@ -1,34 +1,27 @@
|
|||
---
|
||||
- name: Get details about rootfs disks
|
||||
- name: Partition | get details about rootfs disks
|
||||
community.general.parted:
|
||||
device: "{{ item }}"
|
||||
unit: MiB
|
||||
register: base_root_disks_info
|
||||
loop: "{{ base_root_disks | list }}"
|
||||
|
||||
- name: partition | Ensure efi is not mounted
|
||||
ansible.posix.mount:
|
||||
path: /mnt/boot/efi
|
||||
state: unmounted
|
||||
|
||||
- name: Calculate maximum usable disk space
|
||||
- name: Partition | calculate maximum usable disk space
|
||||
ansible.builtin.set_fact:
|
||||
base_root_usable_mib: "{{ (base_root_disks_info.results | map(attribute='disk.size') | min | int) - 1 }}"
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: base_root_usable_mib
|
||||
- name: Calculate disk utilization percentage
|
||||
- name: Partition | calculate disk utilization percentage
|
||||
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: Calculate zfs volume size
|
||||
- name: Partition | calculate zroot ZFS pool size
|
||||
ansible.builtin.set_fact:
|
||||
base_root_zpool_mib: "{{ base_root_usable_mib | int - fixed_size_partitions | int }}"
|
||||
vars:
|
||||
fixed_size_partitions: "{{ base_root_swap_mib | int + base_root_efi_mib | int }}"
|
||||
#
|
||||
- name: Calculate partition layouts
|
||||
- name: Partition | calculate partition layouts
|
||||
ansible.builtin.set_fact:
|
||||
partition_ranges: >-
|
||||
{{
|
||||
|
@ -37,7 +30,7 @@
|
|||
'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:
|
||||
loop_index: "{{ item }}"
|
||||
partitions:
|
||||
|
@ -48,17 +41,19 @@
|
|||
- name: swap
|
||||
size_mib: "{{ base_root_swap_mib }}"
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: partition_ranges
|
||||
|
||||
- name: Initialize partition facts
|
||||
- name: Partition | initialize partitioning facts
|
||||
ansible.builtin.set_fact:
|
||||
base_efi_partitions: []
|
||||
base_root_partitions: []
|
||||
base_swap_partitions: []
|
||||
|
||||
- name: Partition | ensure efi is not mounted
|
||||
ansible.posix.mount:
|
||||
path: /mnt/boot/efi
|
||||
state: unmounted
|
||||
|
||||
#### efi/boot
|
||||
- name: Create EFI partition
|
||||
- name: Partition | create EFI boot partition
|
||||
become: true
|
||||
vars:
|
||||
part_index: 0
|
||||
|
@ -76,10 +71,11 @@
|
|||
loop: "{{ base_root_disks_info.results }}"
|
||||
register: parted_create
|
||||
|
||||
- name: Collect EFI partition devices
|
||||
- name: Partition | collect EFI boot partition devices
|
||||
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Store EFI partition devices
|
||||
ansible.builtin.set_fact:
|
||||
|
@ -91,10 +87,10 @@
|
|||
loop: "{{ lsblk.results | map(attribute='stdout_lines') | sort }}"
|
||||
vars:
|
||||
part_index: 0
|
||||
changed_when: false
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: base_efi_partitions
|
||||
- name: Create root zvol partition
|
||||
#### zroot zfs pool
|
||||
- name: Partition | create root ZFS pool partition
|
||||
become: true
|
||||
vars:
|
||||
part_index: 1
|
||||
|
@ -110,12 +106,13 @@
|
|||
loop: "{{ parted_create.results }}"
|
||||
register: parted_create
|
||||
|
||||
- name: Collect root zvol partition devices
|
||||
- name: Partition | collect root ZFS pool partition devices
|
||||
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
register: lsblk
|
||||
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
|
||||
ansible.builtin.set_fact:
|
||||
base_root_partitions: >-
|
||||
{{ base_root_partitions|d([]) + [
|
||||
|
@ -125,9 +122,10 @@
|
|||
loop: "{{ lsblk.results | map(attribute='stdout_lines') | sort }}"
|
||||
vars:
|
||||
part_index: 1
|
||||
changed_when: false
|
||||
|
||||
#### swap
|
||||
- name: Create swap partition
|
||||
#### swap partitions
|
||||
- name: Partition | create swap partition
|
||||
become: true
|
||||
vars:
|
||||
part_index: 2
|
||||
|
@ -144,13 +142,14 @@
|
|||
register: parted_create
|
||||
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
|
||||
|
||||
- name: Collect swap partition devices
|
||||
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
- name: Partition | Collect swap partition devices
|
||||
ansible.builtin.shell: "set -o pipefail; lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
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
|
||||
ansible.builtin.set_fact:
|
||||
base_swap_partitions: >-
|
||||
{{ base_swap_partitions|d([]) + [
|
||||
|
@ -161,19 +160,21 @@
|
|||
vars:
|
||||
part_index: 2
|
||||
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
|
||||
community.general.parted:
|
||||
unit: MiB
|
||||
device: "{{ item }}"
|
||||
register: base_root_disks_info
|
||||
loop: "{{ base_root_disks | list }}"
|
||||
|
||||
- name: Collect disk device identifiers
|
||||
ansible.builtin.shell: "for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done"
|
||||
- name: Partition | Collect disk device identifiers
|
||||
ansible.builtin.shell: "set -o pipefail; for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done"
|
||||
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
|
||||
ansible.builtin.set_fact:
|
||||
base_partitions_by_id: >-
|
||||
{{
|
||||
|
@ -183,10 +184,3 @@
|
|||
| map('list')
|
||||
)
|
||||
}}
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: base_efi_partitions
|
||||
- ansible.builtin.debug:
|
||||
var: base_root_partitions
|
||||
- ansible.builtin.debug:
|
||||
var: base_swap_partitions
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
---
|
||||
- name: Mount arch zroot
|
||||
- name: Arch Install | Chroot | Mount arch zroot
|
||||
ansible.builtin.command: zfs mount zroot/ROOT/arch
|
||||
- name: Mount all other zroot mountpoints
|
||||
changed_when: false
|
||||
|
||||
- name: Arch Install | Chroot | Mount all other zroot mountpoints
|
||||
ansible.builtin.command: zfs mount -a
|
||||
- name: Create zroot destination directories
|
||||
changed_when: false
|
||||
|
||||
- name: Arch Install | Chroot | Create zroot destination directories
|
||||
ansible.builtin.file:
|
||||
path: "/mnt{{ item }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
loop:
|
||||
- /etc/zfs
|
||||
- /boot/efi
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: base_efi_partitions
|
||||
- name: Mount EFI
|
||||
ansible.posix.mount:
|
||||
path: /mnt/boot/efi
|
||||
|
@ -20,9 +25,19 @@
|
|||
fstype: vfat
|
||||
state: mounted
|
||||
|
||||
- name: zfs | Set zroot bootfs to arch
|
||||
- name: Arch Chroot | zpool | Set zroot bootfs to arch
|
||||
ansible.builtin.command: zpool set bootfs=zroot/ROOT/arch zroot
|
||||
- name: zfs | Set cachefile
|
||||
changed_when: false
|
||||
|
||||
- name: Arch Chroot | zpool | Set cachefile
|
||||
ansible.builtin.command: zpool set cachefile=/etc/zfs/zpool.cache zroot
|
||||
- name: zfs | Copy cache file to chroot
|
||||
ansible.builtin.command: cp /etc/zfs/zpool.cache /mnt/etc/zfs
|
||||
changed_when: false
|
||||
|
||||
- name: Arch Chroot | zpool | copy zpool.cache to installation chroot
|
||||
ansible.builtin.copy:
|
||||
remote_src: true
|
||||
src: /etc/zfs/zpool.cache
|
||||
dest: /mnt/etc/zfs/zpool.cache
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msg: "please specify a root password via -e root_password=<password>"
|
||||
- ansible.builtin.import_tasks: archinstall/mirrorlist.yaml
|
||||
- ansible.builtin.import_tasks: archinstall/partition.yaml
|
||||
- ansible.builtin.import_tasks: archinstall/initialize_root_zvol.yaml
|
||||
- ansible.builtin.import_tasks: archinstall/initialize_root_zfs_pool.yaml
|
||||
- ansible.builtin.import_tasks: archinstall/initialize_swap.yaml
|
||||
- ansible.builtin.import_tasks: archinstall/initialize_efi.yaml
|
||||
- ansible.builtin.import_tasks: archinstall/prepare_chroot.yaml
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
- name: Check for archinstall in path
|
||||
ansible.builtin.command: which archinstall
|
||||
changed_when: false
|
||||
ignore_errors: true
|
||||
register: which_archinstall
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
desktop_user: mark
|
||||
software_desktop_user: mark
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
---
|
||||
- when: not archiso_detected
|
||||
- name: Install system package groups
|
||||
when: not archiso_detected
|
||||
block:
|
||||
- name: Pacman sync
|
||||
- name: Update pacman cache
|
||||
community.general.pacman:
|
||||
update_cache: true
|
||||
|
||||
- ansible.builtin.import_tasks: software/minimal.yaml
|
||||
- ansible.builtin.import_tasks: software/desktop.yaml
|
||||
- ansible.builtin.import_tasks: software/graphics.yaml
|
||||
- ansible.builtin.import_tasks: software/dev.yaml
|
||||
- ansible.builtin.import_tasks: software/gamedev.yaml
|
||||
- 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
|
||||
|
|
|
@ -39,62 +39,72 @@
|
|||
|
||||
- name: Install AUR packages
|
||||
become: true
|
||||
become_user: "{{ desktop_user }}"
|
||||
become_user: "{{ software_desktop_user }}"
|
||||
ansible.builtin.command: >-
|
||||
paru -Sy --needed --noconfirm {{ packages | join(' ') }}
|
||||
changed_when: true
|
||||
vars:
|
||||
packages:
|
||||
- dracula-gtk-theme-full
|
||||
- ttf-envy-code-r
|
||||
- winbox
|
||||
|
||||
- name: loginctl | Enable linger for desktop user
|
||||
ansible.builtin.command: "loginctl enable-linger {{ desktop_user }}"
|
||||
- name: syncthing | Generate default config
|
||||
- name: Enable linger for 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
|
||||
become: true
|
||||
become_user: "{{ desktop_user }}"
|
||||
ansible.builtin.command: >-
|
||||
syncthing generate --no-default-folder --skip-port-probing
|
||||
- name: syncthing | Enable user systemd unit
|
||||
become_user: "{{ software_desktop_user }}"
|
||||
ansible.builtin.command:
|
||||
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
|
||||
ansible.builtin.systemd:
|
||||
name: syncthing.service
|
||||
enabled: true
|
||||
state: started
|
||||
scope: user
|
||||
become: true
|
||||
become_user: "{{ desktop_user }}"
|
||||
become_user: "{{ software_desktop_user }}"
|
||||
|
||||
- name: greetd | configure | use tuigreet
|
||||
- name: Greetd | configure | use tuigreet
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/greetd/config.toml
|
||||
regexp: "^command ="
|
||||
line: command = "tuigreet --cmd sway"
|
||||
|
||||
- name: greetd | Enable systemd unit
|
||||
- name: Greetd | Enable systemd unit
|
||||
ansible.builtin.systemd:
|
||||
name: greetd
|
||||
enabled: true
|
||||
|
||||
- name: bluetooth | Enable systemd unit
|
||||
- name: Bluetooth | Enable systemd unit
|
||||
ansible.builtin.systemd:
|
||||
name: bluetooth
|
||||
enabled: true
|
||||
|
||||
- name: wal | Set initial colorscheme
|
||||
- name: Wal | Set initial colorscheme
|
||||
become: true
|
||||
become_user: "{{ desktop_user }}"
|
||||
become_user: "{{ software_desktop_user }}"
|
||||
ansible.builtin.command: wal --theme hybrid-material
|
||||
- name: sway | Reload if running
|
||||
changed_when: false
|
||||
|
||||
- name: Sway | Reload if running
|
||||
become: true
|
||||
become_user: "{{ desktop_user }}"
|
||||
ansible.builtin.shell: pidof sway && SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) swaymsg reload
|
||||
ignore_errors: true
|
||||
become_user: "{{ software_desktop_user }}"
|
||||
ansible.builtin.shell: set -o pipefail; pidof sway && SWAYSOCK=$(ls /run/user/*/sway-ipc.*.sock | head -n 1) swaymsg reload
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: graphics | Probe for graphics cards
|
||||
ansible.builtin.shell: lspci -nnk | grep -A 3 -E "VGA|3D"
|
||||
- name: Graphics | Probe for graphics cards
|
||||
ansible.builtin.shell: set -o pipefail; lspci -nnk | grep -A 3 -E "VGA|3D"
|
||||
register: lspci
|
||||
changed_when: false
|
||||
|
||||
- name: graphics | Install radeon specific packages
|
||||
- name: Graphics | Install radeon specific packages
|
||||
ansible.builtin.package:
|
||||
state: present
|
||||
name:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue