You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/roles/users/tasks/main.yml

20 lines
518 B
YAML

---
- name: Create users
user:
name: "{{ item.key }}"
groups: "{{ item.value | default('') }}"
shell: "{{ user_dict[item.key].shell | default('/bin/bash') }}"
password: "{{ user_dict[item.key].password_hash }}"
update_password: always
state: present
loop: "{{ users | dict2items }}"
- name: Add SSH key to users
authorized_key:
key: "{{ user_dict[item.key].ssh_keys | join('\n') }}"
user: "{{ item.key }}"
exclusive: no
state: present
loop: "{{ users | dict2items }}"