blob: aa19aabc26bb0d1174d36cbacaf6a0f7609a68e1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
---
- name: add system groups
loop: "{{ system_groups | list }}"
group:
name: "{{ item }}"
state: present
system: yes
- name: add normal groups
loop: "{{ normal_groups | list }}"
group:
name: "{{ item }}"
state: present
## TODO: until something like this https://github.com/ansible/ansible/issues/11024 lands
## we will do this the quick and dirty way
- name: set group members the hacky way
loop: "{{ normal_groups | combine(system_groups) | dict2items }}"
loop_control:
label: "{{ item.key }}"
lineinfile:
path: /etc/group
regexp: '^{{ item.key }}:(.*):[^:]*$'
backrefs: yes
line: '{{ item.key }}:\1:{{ item.value | sort | join(",") }}'
|