fix(groups): Always ensure groups exist before assigning users

This commit is contained in:
Marty Oehme 2025-02-25 21:35:47 +01:00
parent e0d88a9ee1
commit d6636d5b09
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 17 additions and 3 deletions

View file

@ -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"

View file

@ -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