From d6636d5b09db0de91fe729d3d2252479b4738524 Mon Sep 17 00:00:00 2001 From: Marty Oehme <contact@martyoeh.me> Date: Tue, 25 Feb 2025 21:35:47 +0100 Subject: [PATCH] fix(groups): Always ensure groups exist before assigning users --- books/void_user.yaml | 6 ++++++ books/void_wayland.yaml | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/books/void_user.yaml b/books/void_user.yaml index fc1592d..0f3ec00 100644 --- a/books/void_user.yaml +++ b/books/void_user.yaml @@ -2,6 +2,12 @@ hosts: target_system become: true tasks: + - name: Ensure user groups all exist + ansible.builtin.group: + name: "{{ item }}" + state: present + loop: "{{ user_groups }}" + - name: Enable sudo for "wheel" group ansible.builtin.lineinfile: path: "/etc/sudoers" diff --git a/books/void_wayland.yaml b/books/void_wayland.yaml index 4da6830..f7b02bc 100644 --- a/books/void_wayland.yaml +++ b/books/void_wayland.yaml @@ -39,15 +39,23 @@ - xdg-desktop-portal-wlr state: present -- name: Install audio for wayland +- name: Install audio and video for wayland hosts: target_system become: true tags: audio + vars: + audio_groups: [audio, video] tasks: + - 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, video] + groups: "{{ audio_groups }}" append: true - name: Install pipewire @@ -57,7 +65,7 @@ state: present notify: installed-pipewire - - name: Install pipewire + - name: Install pipewire bluetooth community.general.xbps: name: - libspa-bluetooth