ansible-base/roles/users_sudo/tasks/users.yml

21 lines
560 B
YAML
Raw Normal View History

2020-05-15 22:22:26 +02:00
---
- name: Privileged users in group sudo
user:
name: "{{ item }}"
groups: "{{ sudo_group }}"
2020-08-26 21:07:41 +02:00
shell: "{{ sudo_shell }}"
2020-05-15 22:22:26 +02:00
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