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

21 lines
551 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 }}"
shell: /bin/bash
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