Ansible_workstation/tasks/users.yml

28 lines
667 B
YAML
Raw Normal View History

2018-08-22 18:42:52 +00:00
---
2020-03-17 04:44:48 +00:00
- name: users -- Ensure wheel group exists
2019-09-09 19:30:58 +00:00
group:
name: wheel
state: present
- name: create users
2018-08-22 19:14:04 +00:00
user:
2018-08-22 19:18:18 +00:00
name: "{{ item.username }}"
2019-12-14 15:48:53 +00:00
password: "{{ item.password | password_hash('sha512')}}"
2019-05-11 16:30:41 +00:00
group: "{{ item.group }}"
2019-05-12 04:39:55 +00:00
groups: "{{ item.groups }}"
2018-08-22 19:51:47 +00:00
uid: "{{ item.uid }}"
2019-02-08 08:14:50 +00:00
shell: "{{ prompt_place['stdout'] }}"
2019-03-06 08:28:19 +00:00
state: present
with_items: "{{ users }}"
2020-02-24 05:35:41 +00:00
when: create_user
2020-07-16 15:37:34 +00:00
- 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