lab-ansible/roles/common/tasks/users.yml

19 lines
429 B
YAML
Raw Normal View History

2023-10-28 23:00:05 +00:00
# vim: ft=yaml.ansible
2023-10-29 19:46:52 +00:00
# code: language=ansible
2023-10-28 23:00:05 +00:00
---
- name: Add users
ansible.builtin.user:
name: "{{ item.name }}"
comment: "{{ item.comment }}"
groups: "{{ item.groups }}"
shell: /bin/bash
2023-11-05 18:08:26 +00:00
state: present
2023-10-28 23:00:05 +00:00
loop: "{{ users }}"
- name: Add ssh authorized_keys
ansible.posix.authorized_key:
user: "{{ item.name }}"
key: "{{ item.ssh_keys | join('\n') }}"
exclusive: true
loop: "{{ users }}"