diff options
Diffstat (limited to 'roles/core/groups/tasks')
-rw-r--r-- | roles/core/groups/tasks/main.yml | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/core/groups/tasks/main.yml b/roles/core/groups/tasks/main.yml new file mode 100644 index 00000000..aa19aabc --- /dev/null +++ b/roles/core/groups/tasks/main.yml @@ -0,0 +1,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(",") }}' |