fix(groups): Always ensure groups exist before assigning users
This commit is contained in:
parent
e0d88a9ee1
commit
d6636d5b09
2 changed files with 17 additions and 3 deletions
|
@ -2,6 +2,12 @@
|
||||||
hosts: target_system
|
hosts: target_system
|
||||||
become: true
|
become: true
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Ensure user groups all exist
|
||||||
|
ansible.builtin.group:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop: "{{ user_groups }}"
|
||||||
|
|
||||||
- name: Enable sudo for "wheel" group
|
- name: Enable sudo for "wheel" group
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "/etc/sudoers"
|
path: "/etc/sudoers"
|
||||||
|
|
|
@ -39,15 +39,23 @@
|
||||||
- xdg-desktop-portal-wlr
|
- xdg-desktop-portal-wlr
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install audio for wayland
|
- name: Install audio and video for wayland
|
||||||
hosts: target_system
|
hosts: target_system
|
||||||
become: true
|
become: true
|
||||||
tags: audio
|
tags: audio
|
||||||
|
vars:
|
||||||
|
audio_groups: [audio, video]
|
||||||
tasks:
|
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
|
- name: Put user in audio group
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ user_name }}"
|
name: "{{ user_name }}"
|
||||||
groups: [audio, video]
|
groups: "{{ audio_groups }}"
|
||||||
append: true
|
append: true
|
||||||
|
|
||||||
- name: Install pipewire
|
- name: Install pipewire
|
||||||
|
@ -57,7 +65,7 @@
|
||||||
state: present
|
state: present
|
||||||
notify: installed-pipewire
|
notify: installed-pipewire
|
||||||
|
|
||||||
- name: Install pipewire
|
- name: Install pipewire bluetooth
|
||||||
community.general.xbps:
|
community.general.xbps:
|
||||||
name:
|
name:
|
||||||
- libspa-bluetooth
|
- libspa-bluetooth
|
||||||
|
|
Loading…
Reference in a new issue