dd
This commit is contained in:
parent
f0e5331874
commit
a63741d4ed
1 changed files with 7 additions and 9 deletions
|
@ -1,15 +1,11 @@
|
|||
---
|
||||
- name: set groups as list
|
||||
- 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
|
||||
- name: Ensure groups exist
|
||||
ansible.builtin.group:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
|
@ -17,7 +13,7 @@
|
|||
when: groups_as_list is defined
|
||||
# no_log: true # TODO
|
||||
|
||||
- name: create users
|
||||
- name: Ensure users exist
|
||||
ansible.builtin.user:
|
||||
name: "{{ item.username }}"
|
||||
uid: "{{ item.uid | default(omit) }}"
|
||||
|
@ -30,15 +26,16 @@
|
|||
loop: '{{ users }}'
|
||||
# no_log: true # TODO
|
||||
|
||||
- name: add ssh key
|
||||
- name: Ensure user ssh-keys exist
|
||||
ansible.posix.authorized_key:
|
||||
user: "{{ item.username }}"
|
||||
key: "{{ item.public_ssh_key }}"
|
||||
state: present
|
||||
when: item.public_ssh_key is defined
|
||||
loop: '{{ users }}'
|
||||
# no_log: true # TODO
|
||||
|
||||
- name: add to sudoers
|
||||
- name: Ensure users are added to sudoers
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/sudoers
|
||||
state: present
|
||||
|
@ -47,3 +44,4 @@
|
|||
validate: 'visudo -cf %s'
|
||||
when: item.allow_sudo|default(false) and item.allow_sudo is defined
|
||||
loop: '{{ users }}'
|
||||
# no_log: true # TODO
|
||||
|
|
Loading…
Reference in a new issue