linuxinstaller/ansible/ajoute-utilisateur.yml

28 lines
689 B
YAML
Raw Normal View History

2024-10-06 23:44:04 +02:00
- 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