ansible-base/roles/users_sudo/tasks/users.yml
2020-08-26 21:07:41 +02:00

21 lines
560 B
YAML

---
- name: Privileged users in group sudo
user:
name: "{{ item }}"
groups: "{{ sudo_group }}"
shell: "{{ sudo_shell }}"
append: yes
password: "{{ default_user_password }}"
update_password: on_create
loop: "{{ sudo_users }}"
when: sudo_users is defined and (sudo_users|length>0)
- name: Set up authorized key for users
authorized_key:
user: "{{ item }}"
state: present
key: "{{ public_key[item] }}"
loop: "{{ sudo_users }}"
when: sudo_users is defined and (sudo_users|length>0) and public_key[item] is defined