21 lines
662 B
YAML
21 lines
662 B
YAML
|
- name: Ensure groups exists
|
||
|
ansible.builtin.group:
|
||
|
name: "{{ user.groupname }}"
|
||
|
gid: "{{ user.gid | default(None) }}"
|
||
|
state: present
|
||
|
|
||
|
- name: Add users
|
||
|
ansible.builtin.user:
|
||
|
name: "{{ user.username }}"
|
||
|
uid: "{{ user.uid | default(None) }}"
|
||
|
group: "{{ user.groupname | default(user.username) }}"
|
||
|
shell: "{{ user.shell | default('/bin/bash') }}"
|
||
|
move_home: "{{ user.home | default(None) }}"
|
||
|
password: "{{ user.password | default(None) }}"
|
||
|
|
||
|
- name: Add a Github key ssh key
|
||
|
when: "user.github is defined"
|
||
|
ansible.posix.authorized_key:
|
||
|
user: "{{ user.username }}"
|
||
|
key: "https://github.com/{{ user.github }}.keys"
|