Ansible_workstation/tasks/users.yml

28 lines
667 B
YAML

---
- name: users -- Ensure wheel group exists
group:
name: wheel
state: present
- name: create users
user:
name: "{{ item.username }}"
password: "{{ item.password | password_hash('sha512')}}"
group: "{{ item.group }}"
groups: "{{ item.groups }}"
uid: "{{ item.uid }}"
shell: "{{ prompt_place['stdout'] }}"
state: present
with_items: "{{ users }}"
when: create_user
- name: ssh -- Add public key
authorized_key:
user: "{{ item.user.username }}"
key: "{{ lookup('file', 'sshpubs/' + item.key) }}"
state: present
with_items: "{{ public_key }}"
register: add_identity_key
tags:
- first_deployement