SL/ansible/tasks/user.yml

21 lines
662 B
YAML
Raw Normal View History

2022-06-13 22:09:07 +02:00
- 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"