This commit is contained in:
2024-04-01 10:40:20 +02:00
parent 5152f44924
commit 8a7c4f3724
154 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# tasks file for create_admin_user
- name Add the user with a specific uid and a primary group of "admin"
ansible.builtin.user:
name: "{{ item.name }}"
comment: "{{ item.comment }}"
uid: "{{ item.uid }}"
loop: "{{ admin }}"
- name: Setup authorized key
ansible.posix.authorized_key
user: "{{ item.name }}"
key: "{{ lookup('file', 'pud_key/{{ item.name }}.pub') }}"
loop: "{{ admin }}"
- name: Update sudoers file and validate
ansible.builtin.lineinfile:
dest: /etc/sudoers
insertafter: EOF
line: "{{ item.name }} ALL=(ALL) NOPASSWD: ALL"
regexp: "^{{ item.name }} .*"
state: present
loop: "{{ admin }}"