From 0ff45ab2577b57710b25450d9c3a047acc5703ea Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Tue, 8 Oct 2024 16:42:02 +0200 Subject: [PATCH] dd --- roles/mgrote_users/tasks/main.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/roles/mgrote_users/tasks/main.yml b/roles/mgrote_users/tasks/main.yml index 0a8032de..1d58c56a 100644 --- a/roles/mgrote_users/tasks/main.yml +++ b/roles/mgrote_users/tasks/main.yml @@ -1,10 +1,21 @@ --- +- name: set groups as list + ansible.builtin.set_fact: + groups_as_list: "{{ ((( item.groups ) | list) | sort) | unique }}" + loop: "{{ users }}" + when: item.groups is defined + +- name: debug 1 + ansible.builtin.debug: + msg: '{{ groups_as_list }}' + - name: create groups ansible.builtin.group: - name: "{{ ((item.groups) | sort) | unique }}" + name: "{{ item }}" state: present - loop: '{{ users }}' + loop: '{{ groups_as_list }}' when: item.groups is defined + # no_log: true # TODO - name: create users ansible.builtin.user: @@ -17,6 +28,7 @@ createhome: "{{ item.createhome | default('yes') }}" state: "{{ item.state | default('present') }}" loop: '{{ users }}' + # no_log: true # TODO - name: add ssh key ansible.posix.authorized_key: