2024-10-06 23:44:04 +02:00
|
|
|
- name: Ajoute utilisateur
|
|
|
|
hosts: localhost
|
|
|
|
vars:
|
|
|
|
default_groups:
|
|
|
|
- cdrom
|
|
|
|
- dip
|
|
|
|
- plugdev
|
|
|
|
- users
|
|
|
|
- lpadmin
|
|
|
|
- sambashare
|
2024-10-19 17:14:13 +02:00
|
|
|
# vars_prompt:
|
|
|
|
# - name: username
|
|
|
|
# prompt: "Identifiant de l'utilisateur concerné"
|
|
|
|
# private: false
|
|
|
|
# - name: prenom_nom
|
|
|
|
# prompt: "Prénom et nom de l'utilisateur"
|
|
|
|
# private: false
|
2024-10-06 23:44:04 +02:00
|
|
|
|
|
|
|
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
|