ref(playbook): Change to role-based structure
This commit is contained in:
parent
95fd68bed8
commit
b3b280fbe4
39 changed files with 635 additions and 601 deletions
7
roles/backup/files/snapper-snap-script
Executable file
7
roles/backup/files/snapper-snap-script
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CONFIG="${SNAP_CONFIG:-root}"
|
||||
|
||||
echo RUNNING: snapper --config="$CONFIG" --quiet create --description="${*//sudo /}" --cleanup-algorithm="number"
|
||||
|
||||
"$@"
|
||||
5
roles/backup/tasks/main.yaml
Normal file
5
roles/backup/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
- name: Set up snapper snapshots
|
||||
import_tasks: snapper.yaml
|
||||
tags:
|
||||
- btrfs
|
||||
- snapshots
|
||||
67
roles/backup/tasks/snapper.yaml
Normal file
67
roles/backup/tasks/snapper.yaml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
- name: Install snapper
|
||||
community.general.xbps:
|
||||
name:
|
||||
- snapper
|
||||
state: present
|
||||
|
||||
# https://wiki.archlinux.org/title/Snapper#updatedb
|
||||
- name: Disable updatedb indexing for snapshot directories
|
||||
ansible.builtin.copy:
|
||||
content: 'PRUNENAMES = ".snapshots"'
|
||||
dest: "/etc/updatedb.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: true
|
||||
|
||||
- name: Ensure snapper configs directory exists
|
||||
ansible.builtin.file:
|
||||
dest: "/etc/snapper/configs"
|
||||
state: directory
|
||||
recurse: true
|
||||
|
||||
- name: Ensure root /.snapshots directory exists
|
||||
ansible.builtin.file:
|
||||
dest: "/.snapshots"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Create root backup configuration
|
||||
ansible.builtin.template:
|
||||
src: snapper-configurations/root.j2
|
||||
dest: "/etc/snapper/configs/root"
|
||||
mode: 0640
|
||||
force: true # ensure contents are always exact
|
||||
|
||||
- name: Ensure home /.snapshots directory exists
|
||||
ansible.builtin.file:
|
||||
dest: "/home/.snapshots"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Create homedir backup configuration
|
||||
ansible.builtin.template:
|
||||
src: snapper-configurations/home.j2
|
||||
dest: "/etc/snapper/configs/home"
|
||||
mode: 0640
|
||||
force: true
|
||||
|
||||
- name: Add snap manual safety command
|
||||
ansible.builtin.copy:
|
||||
src: snapper-snap-script
|
||||
dest: "/usr/bin/snap"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
# For now we never activate the snapper daemon
|
||||
# Does not work without elogind?
|
||||
# Using snooze (i.e. cron) enabled recurring
|
||||
# backup tasks instead.
|
||||
# - name: Activate snapper service
|
||||
# ansible.builtin.file:
|
||||
# force: "yes"
|
||||
# src: "/etc/sv/snapperd"
|
||||
# dest: "/etc/runit/runsvdir/default/snapperd"
|
||||
# state: link
|
||||
# tags: never
|
||||
55
roles/backup/templates/snapper-configurations/home.j2
Normal file
55
roles/backup/templates/snapper-configurations/home.j2
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# subvolume to snapshot
|
||||
SUBVOLUME="/home"
|
||||
|
||||
# filesystem type
|
||||
FSTYPE="btrfs"
|
||||
|
||||
# btrfs qgroup for space aware cleanup algorithms
|
||||
QGROUP=""
|
||||
|
||||
# fraction or absolute size of the filesystems space the snapshots may use
|
||||
SPACE_LIMIT="0.5"
|
||||
|
||||
# fraction or absolute size of the filesystems space that should be free
|
||||
FREE_LIMIT="0.2"
|
||||
|
||||
# users and groups allowed to work with config
|
||||
ALLOW_USERS="{{ user_name }}"
|
||||
ALLOW_GROUPS=""
|
||||
|
||||
# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots
|
||||
# directory
|
||||
SYNC_ACL="no"
|
||||
|
||||
# start comparing pre- and post-snapshot in background after creating
|
||||
# post-snapshot
|
||||
BACKGROUND_COMPARISON="yes"
|
||||
|
||||
# run daily number cleanup
|
||||
NUMBER_CLEANUP="yes"
|
||||
|
||||
# limit for number cleanup
|
||||
NUMBER_MIN_AGE="1800"
|
||||
NUMBER_LIMIT="4"
|
||||
NUMBER_LIMIT_IMPORTANT="2"
|
||||
|
||||
# create hourly snapshots
|
||||
TIMELINE_CREATE="yes"
|
||||
|
||||
# cleanup hourly snapshots after some time
|
||||
TIMELINE_CLEANUP="yes"
|
||||
|
||||
# limits for timeline cleanup
|
||||
TIMELINE_MIN_AGE="1800"
|
||||
TIMELINE_LIMIT_HOURLY="10"
|
||||
TIMELINE_LIMIT_DAILY="2"
|
||||
TIMELINE_LIMIT_WEEKLY="1"
|
||||
TIMELINE_LIMIT_MONTHLY="1"
|
||||
TIMELINE_LIMIT_QUARTERLY="0"
|
||||
TIMELINE_LIMIT_YEARLY="0"
|
||||
|
||||
# cleanup empty pre-post-pairs
|
||||
EMPTY_PRE_POST_CLEANUP="yes"
|
||||
|
||||
# limits for empty pre-post-pair cleanup
|
||||
EMPTY_PRE_POST_MIN_AGE="1800"
|
||||
55
roles/backup/templates/snapper-configurations/root.j2
Normal file
55
roles/backup/templates/snapper-configurations/root.j2
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# subvolume to snapshot
|
||||
SUBVOLUME="/"
|
||||
|
||||
# filesystem type
|
||||
FSTYPE="btrfs"
|
||||
|
||||
# btrfs qgroup for space aware cleanup algorithms
|
||||
QGROUP=""
|
||||
|
||||
# fraction or absolute size of the filesystems space the snapshots may use
|
||||
SPACE_LIMIT="0.5"
|
||||
|
||||
# fraction or absolute size of the filesystems space that should be free
|
||||
FREE_LIMIT="0.2"
|
||||
|
||||
# users and groups allowed to work with config
|
||||
ALLOW_USERS="{{ user_name }}"
|
||||
ALLOW_GROUPS=""
|
||||
|
||||
# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots
|
||||
# directory
|
||||
SYNC_ACL="no"
|
||||
|
||||
# start comparing pre- and post-snapshot in background after creating
|
||||
# post-snapshot
|
||||
BACKGROUND_COMPARISON="yes"
|
||||
|
||||
# run daily number cleanup
|
||||
NUMBER_CLEANUP="yes"
|
||||
|
||||
# limit for number cleanup
|
||||
NUMBER_MIN_AGE="1800"
|
||||
NUMBER_LIMIT="6"
|
||||
NUMBER_LIMIT_IMPORTANT="4"
|
||||
|
||||
# create hourly snapshots
|
||||
TIMELINE_CREATE="yes"
|
||||
|
||||
# cleanup hourly snapshots after some time
|
||||
TIMELINE_CLEANUP="yes"
|
||||
|
||||
# limits for timeline cleanup
|
||||
TIMELINE_MIN_AGE="1800"
|
||||
TIMELINE_LIMIT_HOURLY="6"
|
||||
TIMELINE_LIMIT_DAILY="5"
|
||||
TIMELINE_LIMIT_WEEKLY="2"
|
||||
TIMELINE_LIMIT_MONTHLY="1"
|
||||
TIMELINE_LIMIT_QUARTERLY="1"
|
||||
TIMELINE_LIMIT_YEARLY="0"
|
||||
|
||||
# cleanup empty pre-post-pairs
|
||||
EMPTY_PRE_POST_CLEANUP="yes"
|
||||
|
||||
# limits for empty pre-post-pair cleanup
|
||||
EMPTY_PRE_POST_MIN_AGE="1800"
|
||||
0
roles/backup/vars/main.yaml
Normal file
0
roles/backup/vars/main.yaml
Normal file
31
roles/base/handlers/main.yaml
Normal file
31
roles/base/handlers/main.yaml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
- name: List kernel module dirs
|
||||
ansible.builtin.find:
|
||||
paths: "/usr/lib/modules"
|
||||
file_type: directory
|
||||
register: found_kernels
|
||||
listen: installed-booster
|
||||
|
||||
- name: Find kernels
|
||||
ansible.builtin.set_fact:
|
||||
kernel_list: "{{ found_kernels['files'] | map(attribute='path') | map('regex_replace', '^.*/(.*)$', '\\1') | list }}"
|
||||
listen: installed-booster
|
||||
|
||||
- name: Create booster initramfs
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- booster
|
||||
- --verbose
|
||||
- build
|
||||
- --kernel-version={{ item }}
|
||||
- "{{ fname }}-{{ item }}.img"
|
||||
creates: "{{ fname }}-{{ item }}.img"
|
||||
loop: "{{ kernel_list }}"
|
||||
listen: installed-booster
|
||||
|
||||
- name: Regenerate locales
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- xbps-reconfigure
|
||||
- --force
|
||||
- libc-locales
|
||||
listen: glibc-locales-changed
|
||||
122
roles/base/tasks/main.yaml
Normal file
122
roles/base/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
# Prefer booster to dracut so make sure to never install it
|
||||
- name: Ignore dracut
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/xbps.d/ignore-dracut.conf
|
||||
line: ignorepkg=dracut
|
||||
state: present
|
||||
create: true # create file if absent
|
||||
tags:
|
||||
- packages
|
||||
- dracut
|
||||
|
||||
- name: Update xbps and system
|
||||
community.general.xbps:
|
||||
name:
|
||||
- xbps
|
||||
state: latest
|
||||
update_cache: true
|
||||
upgrade: true
|
||||
tags:
|
||||
- packages
|
||||
- update
|
||||
|
||||
- name: Install Base system
|
||||
community.general.xbps:
|
||||
name:
|
||||
- base-system
|
||||
state: present
|
||||
tags:
|
||||
- packages
|
||||
|
||||
- name: Get rid of temporary container metapackage
|
||||
community.general.xbps:
|
||||
name:
|
||||
- base-container-full
|
||||
state: absent
|
||||
tags:
|
||||
- packages
|
||||
|
||||
- name: Install booster
|
||||
community.general.xbps:
|
||||
name: booster
|
||||
state: present
|
||||
notify: installed-booster
|
||||
tags:
|
||||
- packages
|
||||
- booster
|
||||
|
||||
- name: Set hostname
|
||||
ansible.builtin.template:
|
||||
src: hostname.j2
|
||||
dest: /etc/hostname
|
||||
tags: hostname
|
||||
|
||||
- name: Set timezone
|
||||
ansible.builtin.file:
|
||||
path: /etc/localtime
|
||||
src: /usr/share/zoneinfo/{{ timezone }}
|
||||
state: link
|
||||
tags: timezone
|
||||
|
||||
- name: Install glibc
|
||||
tags: glibc
|
||||
block:
|
||||
- name: Check if glibc locales exist
|
||||
ansible.builtin.stat:
|
||||
path: /etc/default/libc-locales
|
||||
register: libc_locales_file
|
||||
|
||||
- name: Set correct glibc locales
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/default/libc-locales
|
||||
regexp: "^{{ item }}"
|
||||
line: "{{ item }}"
|
||||
state: present
|
||||
create: true
|
||||
loop: "{{ locales_enabled }}"
|
||||
when: libc_locales_file.stat.exists
|
||||
notify: glibc-locales-changed
|
||||
|
||||
- name: Set up chrony for NTP management
|
||||
community.general.xbps:
|
||||
name:
|
||||
- chrony
|
||||
state: present
|
||||
tags: chrony
|
||||
|
||||
- name: Activate chronyd service
|
||||
ansible.builtin.file:
|
||||
src: "/etc/sv/chronyd"
|
||||
dest: "/etc/runit/runsvdir/default/chronyd"
|
||||
state: link
|
||||
tags: chrony
|
||||
|
||||
- name: Activate acpid service
|
||||
ansible.builtin.file:
|
||||
src: "/etc/sv/acpid"
|
||||
dest: "/etc/runit/runsvdir/default/acpid"
|
||||
state: link
|
||||
tags: acpid
|
||||
|
||||
- name: Set up snooze as cron daemon
|
||||
tags:
|
||||
- cron
|
||||
- snooze
|
||||
block:
|
||||
- name: Install snooze
|
||||
community.general.xbps:
|
||||
name:
|
||||
- snooze
|
||||
state: present
|
||||
|
||||
- name: Activate snooze cron services
|
||||
ansible.builtin.file:
|
||||
force: "yes"
|
||||
src: "/etc/sv/{{ item }}"
|
||||
dest: "/etc/runit/runsvdir/default/{{ item }}"
|
||||
state: link
|
||||
loop:
|
||||
- snooze-hourly
|
||||
- snooze-daily
|
||||
- snooze-weekly
|
||||
- snooze-monthly
|
||||
1
roles/base/templates/hostname.j2
Normal file
1
roles/base/templates/hostname.j2
Normal file
|
|
@ -0,0 +1 @@
|
|||
{{ host_name }}
|
||||
6
roles/base/vars/main.yaml
Normal file
6
roles/base/vars/main.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
booster_initramfs_name: /boot/booster-void
|
||||
host_name: voider
|
||||
timezone: Europe/Berlin
|
||||
locales_enabled:
|
||||
- en_US.UTF-8 UTF-8
|
||||
16
roles/bluetooth/tasks/main.yaml
Normal file
16
roles/bluetooth/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
- name: Install bluetooth packages
|
||||
community.general.xbps:
|
||||
name:
|
||||
- bluez
|
||||
state: "{{ desired_package_state }}"
|
||||
tags: packages
|
||||
|
||||
- name: Activate bluetooth service
|
||||
ansible.builtin.file:
|
||||
force: "yes"
|
||||
src: "/etc/sv/{{ item }}"
|
||||
dest: "/etc/runit/runsvdir/default/{{ item }}"
|
||||
state: link
|
||||
with_items:
|
||||
- bluetoothd
|
||||
- dbus
|
||||
29
roles/display_manager/tasks/main.yaml
Normal file
29
roles/display_manager/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- name: Ensure user group for greeter exists
|
||||
ansible.builtin.group:
|
||||
name: "{{ greeter_user }}"
|
||||
state: present
|
||||
|
||||
- name: Install greetd and tuigreet
|
||||
community.general.xbps:
|
||||
name:
|
||||
- greetd
|
||||
- tuigreet
|
||||
state: present
|
||||
tags:
|
||||
- packages
|
||||
|
||||
- name: Set up tuigreet config for greetd
|
||||
ansible.builtin.template:
|
||||
src: greetd-config.toml.j2
|
||||
dest: "/etc/greetd/config.toml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: true
|
||||
|
||||
- name: Activate greetd service
|
||||
ansible.builtin.file:
|
||||
src: "/etc/sv/greetd"
|
||||
dest: "/etc/runit/runsvdir/default/greetd"
|
||||
state: link
|
||||
18
roles/display_manager/templates/greetd-config.toml.j2
Normal file
18
roles/display_manager/templates/greetd-config.toml.j2
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[terminal]
|
||||
# The VT to run the greeter on. Can be "next", "current" or a number
|
||||
# designating the VT.
|
||||
vt = 7
|
||||
|
||||
# The default session, also known as the greeter.
|
||||
[default_session]
|
||||
command = "tuigreet --cmd zsh"
|
||||
user = "{{ greeter_user }}"
|
||||
|
||||
# `agreety` is the bundled agetty/login-lookalike. You can replace `/bin/sh`
|
||||
# with whatever you want started, such as `sway`.
|
||||
# command = "agreety --cmd /bin/sh"
|
||||
|
||||
# The user to run the command as. The privileges this user must have depends
|
||||
# on the greeter. A graphical greeter may for example require the user to be
|
||||
# in the `video` group.
|
||||
#user = "_greeter"
|
||||
2
roles/display_manager/vars/main.yaml
Normal file
2
roles/display_manager/vars/main.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
greeter_user: _greeter
|
||||
9
roles/fonts/handlers/main.yaml
Normal file
9
roles/fonts/handlers/main.yaml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
- name: Regenerate fontconfig
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- xbps-reconfigure
|
||||
- --force
|
||||
- fontconfig
|
||||
listen: installed-fonts
|
||||
|
||||
8
roles/fonts/tasks/main.yaml
Normal file
8
roles/fonts/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
- name: Install many fonts
|
||||
community.general.xbps:
|
||||
name: "{{ fonts }}"
|
||||
state: "{{ desired_package_state }}"
|
||||
notify: installed-fonts
|
||||
when: fonts
|
||||
|
||||
18
roles/gnupg/tasks/main.yaml
Normal file
18
roles/gnupg/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
- name: Install gnupg and smartcard addon
|
||||
community.general.xbps:
|
||||
name:
|
||||
- gnupg
|
||||
- gnupg2-scdaemon
|
||||
state: "{{ desired_package_state }}"
|
||||
tags: packages
|
||||
|
||||
- name: Ensure user group plugdev exist
|
||||
ansible.builtin.group:
|
||||
name: plugdev
|
||||
state: present
|
||||
|
||||
- name: Put user in plugdev group
|
||||
ansible.builtin.user:
|
||||
name: "{{ user_name }}"
|
||||
groups: [plugdev]
|
||||
append: true
|
||||
3
roles/host/defaults/main.yml
Normal file
3
roles/host/defaults/main.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
mount_dir: /mnt/void
|
||||
tarball_url: "https://repo-default.voidlinux.org/live/current/void-x86_64-ROOTFS-20250202.tar.xz"
|
||||
36
roles/host/tasks/main.yaml
Normal file
36
roles/host/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# # The subvol collection seems to be misbehaving?
|
||||
# # https://github.com/ansible-collections/community.general/issues/7098
|
||||
# # (and btrfs_subvol module working)
|
||||
# - name: Create void btrfs subvol
|
||||
# hosts: host
|
||||
# vars:
|
||||
# btrfs_target: 441a90a5-3da2-46ce-9e32-987569b746c9
|
||||
# mount_dir: /mnt/void
|
||||
# become: true
|
||||
# tasks:
|
||||
# - name: Create @voidroot subvool under root
|
||||
# community.general.btrfs_subvolume:
|
||||
# state: present
|
||||
# name: "/@"
|
||||
# filesystem_uuid: "{{ btrfs_root_uuid }}"
|
||||
# # - name: Mount /boot part into voidroot mount
|
||||
# - name: Mount btrfs subvol into mountdir
|
||||
# vars:
|
||||
# boot_dev_uuid:
|
||||
# ansible.posix.mount:
|
||||
# src: "{{ item.src }}"
|
||||
# path: "{{ item.path }}"
|
||||
# fstype: "{{ item.fstype }}"
|
||||
# state: mounted
|
||||
# with_items:
|
||||
# - { fstype: 'ext4', src: '/dev/mapper/{{ vgname }}-root', path: '{{ mount_dir }}/' }
|
||||
# # TODO: should take opts from fstab. Definitely needs 'boot' type option
|
||||
# - { fstype: 'vfat', src: '/dev/disk/by-uuid/{{ boot_dev_uuid }}', path: '{{ mount_dir }}/boot' }
|
||||
|
||||
- name: Unpack rootfs
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: yes # we already downloaded it to the 'remote' system
|
||||
src: "{{ tarball_url }}"
|
||||
dest: "{{ mount_dir }}"
|
||||
# ONLY run if this file does not exist (could use any rootfs file to check)
|
||||
creates: "{{ mount_dir }}/etc/os-release"
|
||||
41
roles/keyd/files/default.conf
Normal file
41
roles/keyd/files/default.conf
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# Makes capslock to control/escape
|
||||
# insert to paste
|
||||
# right alt to enable German Umlaute (äÄöÖüÜ),
|
||||
# sharp s (ß), and the Euro sign (€).
|
||||
# Needs compose key to be set in xkb to work correctly:
|
||||
# $ setxkbmap -option "compose:menu"
|
||||
|
||||
[ids]
|
||||
|
||||
*
|
||||
|
||||
[main]
|
||||
|
||||
capslock = overload(control, esc)
|
||||
insert = S-insert
|
||||
rightalt = layer(dia)
|
||||
shift = layer(shift)
|
||||
rightshift = layer(shift)
|
||||
|
||||
[shift:S]
|
||||
|
||||
rightalt = layer(shiftedDia)
|
||||
|
||||
[dia]
|
||||
|
||||
shift = layer(shiftedDia)
|
||||
rightshift = layer(shiftedDia)
|
||||
|
||||
a = macro(compose a ")
|
||||
o = macro(compose o ")
|
||||
u = macro(compose u ")
|
||||
s = macro(compose s s)
|
||||
e = macro(compose = e)
|
||||
|
||||
[shiftedDia]
|
||||
|
||||
a = macro(compose A ")
|
||||
o = macro(compose O ")
|
||||
u = macro(compose U ")
|
||||
s = macro(compose S S)
|
||||
e = macro(compose l -)
|
||||
22
roles/keyd/tasks/main.yaml
Normal file
22
roles/keyd/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
- name: Install keyd
|
||||
community.general.xbps:
|
||||
name:
|
||||
- keyd
|
||||
state: "{{ desired_package_state }}"
|
||||
tags:
|
||||
- packages
|
||||
|
||||
- name: Set up keyd umlaut configuration
|
||||
ansible.builtin.copy:
|
||||
src: default.conf
|
||||
dest: "/etc/keyd/default.conf"
|
||||
force: yes
|
||||
|
||||
- name: Activate keyd service
|
||||
ansible.builtin.file:
|
||||
src: "/etc/sv/keyd"
|
||||
dest: "/etc/runit/runsvdir/default/keyd"
|
||||
state: link
|
||||
force: true
|
||||
|
||||
21
roles/network/tasks/main.yaml
Normal file
21
roles/network/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- name: Configure resolv DNS
|
||||
ansible.builtin.copy:
|
||||
mode: 0644
|
||||
dest: "/etc/resolv.conf"
|
||||
content: |
|
||||
nameserver {{ nameserver1 }}
|
||||
nameserver {{ nameserver2 }}
|
||||
failed_when: false # can't ever fail
|
||||
|
||||
- name: Activate dhcp service
|
||||
ansible.builtin.file:
|
||||
src: "/etc/sv/dhcpcd"
|
||||
dest: "/etc/runit/runsvdir/default/dhcpcd"
|
||||
state: link
|
||||
|
||||
- name: Set up wireless networking
|
||||
import_tasks: wireless.yaml
|
||||
tags:
|
||||
- wireless
|
||||
- iwd
|
||||
13
roles/network/tasks/wireless.yaml
Normal file
13
roles/network/tasks/wireless.yaml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Install iwd
|
||||
community.general.xbps:
|
||||
name:
|
||||
- iwd
|
||||
state: present
|
||||
|
||||
- name: Activate wireless networking service
|
||||
ansible.builtin.file:
|
||||
src: "/etc/sv/iwd"
|
||||
dest: "/etc/runit/runsvdir/default/iwd"
|
||||
state: link
|
||||
|
||||
3
roles/network/vars/main.yaml
Normal file
3
roles/network/vars/main.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
nameserver1: 9.9.9.9
|
||||
nameserver2: 9.9.9.10
|
||||
4
roles/packages/tasks/main.yaml
Normal file
4
roles/packages/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- name: Install all my used void packages
|
||||
community.general.xbps:
|
||||
name: "{{ lookup('community.general.merge_variables', '^packages_.*') }}"
|
||||
state: "{{ desired_package_state }}"
|
||||
49
roles/pipewire/tasks/main.yaml
Normal file
49
roles/pipewire/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
- name: Ensure user group for audio/video exists
|
||||
ansible.builtin.group:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ audio_groups }}"
|
||||
|
||||
- name: Put user in audio group
|
||||
ansible.builtin.user:
|
||||
name: "{{ user_name }}"
|
||||
groups: "{{ audio_groups }}"
|
||||
append: true
|
||||
|
||||
- name: Install pipewire
|
||||
community.general.xbps:
|
||||
name:
|
||||
- pipewire
|
||||
state: present
|
||||
tags: packages
|
||||
|
||||
- name: Install pipewire bluetooth
|
||||
community.general.xbps:
|
||||
name:
|
||||
- libspa-bluetooth
|
||||
state: present
|
||||
tags:
|
||||
- packages
|
||||
- bluetooth
|
||||
|
||||
- name: Set up wireplumber to auto start
|
||||
ansible.builtin.file:
|
||||
dest: "/etc/pipewire/pipewire.conf.d"
|
||||
state: directory
|
||||
|
||||
# FIXME: Does not work automatically for some reason?
|
||||
- name: Set up wireplumber to auto start
|
||||
ansible.builtin.file:
|
||||
force: "yes"
|
||||
src: "/usr/share/examples/wireplumber/10-wireplumber.conf"
|
||||
dest: "/etc/pipewire/pipewire.conf.d/10-wireplumber.conf"
|
||||
state: link
|
||||
|
||||
- name: Enable pipewire-pulse interface
|
||||
ansible.builtin.file:
|
||||
force: "yes"
|
||||
src: "/usr/share/examples/pipewire/20-pipewire-pulse.conf"
|
||||
dest: "/etc/pipewire/pipewire.conf.d/20-pipewire-pulse.conf"
|
||||
state: link
|
||||
|
||||
# TODO: Find way to install and enable pipewire-roc-sink module (and enable ~/.config/pipewire/pipewire.conf.d/roc-sink.conf)
|
||||
4
roles/pipewire/vars/main.yaml
Normal file
4
roles/pipewire/vars/main.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
audio_groups:
|
||||
- audio
|
||||
- video
|
||||
20
roles/power/tasks/main.yaml
Normal file
20
roles/power/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- name: Ensure user group "power" exists
|
||||
ansible.builtin.group:
|
||||
name: power
|
||||
state: present
|
||||
|
||||
- name: Put user in power group
|
||||
ansible.builtin.user:
|
||||
name: "{{ user_name }}"
|
||||
groups: [power]
|
||||
append: true
|
||||
|
||||
- name: Enable power management for power group
|
||||
ansible.builtin.copy:
|
||||
content: "%power ALL=(ALL) NOPASSWD: /usr/bin/halt, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/shutdown, /usr/bin/zzz, /usr/bin/ZZZ"
|
||||
dest: "/etc/sudoers.d/20-power"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: true
|
||||
0
roles/power/vars/main.yaml
Normal file
0
roles/power/vars/main.yaml
Normal file
27
roles/user/tasks/main.yaml
Normal file
27
roles/user/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
- name: Enable sudo access for "wheel" group
|
||||
ansible.builtin.copy:
|
||||
content: "%wheel ALL=(ALL) ALL"
|
||||
dest: "/etc/sudoers.d/10-wheel"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: true
|
||||
tags: sudo
|
||||
|
||||
- name: Ensure all desired user groups exist
|
||||
ansible.builtin.group:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ user_groups }}"
|
||||
|
||||
- name: Add primary user
|
||||
ansible.builtin.user:
|
||||
name: "{{ user_name }}"
|
||||
password: "{{ user_pass | password_hash('sha512', '{{ user_pass_salt}}') }}"
|
||||
create_home: true
|
||||
shell: "/bin/{{ user_shell }}"
|
||||
group: "{{ user_name }}"
|
||||
groups: "{{ user_groups }}"
|
||||
generate_ssh_key: true
|
||||
tags:
|
||||
- passlib
|
||||
18
roles/user/vars/main.yaml
Normal file
18
roles/user/vars/main.yaml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
user_pass_salt: supersecretsalt
|
||||
user_name: voidboi
|
||||
user_pass: voidlinux
|
||||
user_shell: zsh
|
||||
user_shell: zsh
|
||||
user_groups:
|
||||
- wheel
|
||||
- _seatd # TODO: This will error if it does not exist? (seatd not installed)
|
||||
- dialout
|
||||
- disk
|
||||
- input
|
||||
- kvm
|
||||
- lp
|
||||
- plugdev
|
||||
- scanner
|
||||
- storage
|
||||
- usbmon
|
||||
|
||||
16
roles/wayland/files/runit.conf
Normal file
16
roles/wayland/files/runit.conf
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# This is the configuration file for turnstile's runit backend.
|
||||
#
|
||||
# It follows the POSIX shell syntax (being sourced into a script).
|
||||
# The complete launch environment available to dinit can be used.
|
||||
#
|
||||
# It is a low-level configuration file. In most cases, it should
|
||||
# not be modified by the user.
|
||||
|
||||
# the name of the service that turnstile will check for login readiness
|
||||
ready_sv="turnstile-ready"
|
||||
|
||||
# the directory user service files are read from.
|
||||
services_dir="${HOME}/.local/state/service"
|
||||
|
||||
# the environment variable directory user service files can read from.
|
||||
service_env_dir="${HOME}/.local/state/service-env"
|
||||
54
roles/wayland/tasks/main.yaml
Normal file
54
roles/wayland/tasks/main.yaml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
- name: Install intel wayland drivers
|
||||
community.general.xbps:
|
||||
name:
|
||||
- mesa-dri
|
||||
state: present
|
||||
tags:
|
||||
- intel
|
||||
- drivers
|
||||
- packages
|
||||
|
||||
- name: Install wayland packages
|
||||
community.general.xbps:
|
||||
name:
|
||||
- dbus
|
||||
- seatd
|
||||
- turnstile
|
||||
state: present
|
||||
tags:
|
||||
- packages
|
||||
|
||||
- name: Activate wayland services
|
||||
ansible.builtin.file:
|
||||
force: "yes"
|
||||
src: "/etc/sv/{{ item }}"
|
||||
dest: "/etc/runit/runsvdir/default/{{ item }}"
|
||||
state: link
|
||||
with_items: [dbus, turnstiled, seatd]
|
||||
|
||||
- name: Set user service directory to $HOME/.local/state/service
|
||||
ansible.builtin.copy:
|
||||
src: runit.conf
|
||||
dest: /etc/turnstile/backend/runit.conf
|
||||
mode: 0644
|
||||
|
||||
- name: Install wlr desktop portals
|
||||
community.general.xbps:
|
||||
name:
|
||||
- xdg-desktop-portal
|
||||
- xdg-desktop-portal-wlr
|
||||
state: present
|
||||
tags: desktop-portal
|
||||
tags:
|
||||
- packages
|
||||
|
||||
# required e.g. for sioyek to work in wayland void
|
||||
- name: Install qt5 and qt6 wayland libraries
|
||||
community.general.xbps:
|
||||
name:
|
||||
- qt5-wayland
|
||||
- qt6-wayland
|
||||
state: present
|
||||
tags:
|
||||
- packages
|
||||
- qt
|
||||
Loading…
Add table
Add a link
Reference in a new issue