28 lines
689 B
YAML
28 lines
689 B
YAML
|
- name: Ajoute utilisateur
|
||
|
hosts: localhost
|
||
|
vars:
|
||
|
default_groups:
|
||
|
- cdrom
|
||
|
- dip
|
||
|
- plugdev
|
||
|
- users
|
||
|
- lpadmin
|
||
|
- sambashare
|
||
|
|
||
|
tasks:
|
||
|
- name: Configure un compte pour {{ username }}
|
||
|
ansible.builtin.user:
|
||
|
name: "{{ username }}"
|
||
|
comment: "{{ prenom_nom }}"
|
||
|
groups: "{{ default_groups }}"
|
||
|
append: true
|
||
|
password: "{{ 'achanger' | password_hash('sha512') }}"
|
||
|
update_password: on_create
|
||
|
create_home: true
|
||
|
shell: /bin/bash
|
||
|
register: _user
|
||
|
|
||
|
- name: Expire le mot de passe de {{ username }}
|
||
|
ansible.builtin.command: passwd -e {{ username }}
|
||
|
when: _user.changed
|