lab-ansible/roles/common/tasks/users.yml
2023-11-11 16:41:47 +01:00

28 lines
600 B
YAML

# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Add users
ansible.builtin.user:
name: "{{ item.name }}"
comment: "{{ item.comment }}"
groups: "{{ item.groups }}"
shell: /bin/bash
state: present
loop: "{{ users }}"
- name: Add SSH keys to users
ansible.posix.authorized_key:
user: "{{ item.name }}"
key: "{{ item.ssh_keys | join('\n') }}"
exclusive: true
loop: "{{ users }}"
- name: Allow passwordless sudo
community.general.sudoers:
name: passwordless
group: sudo
host: ALL
commands: ALL
nopassword: true
state: present