solution avec verif de la complexité du mot de passe

This commit is contained in:
2023-06-09 11:01:37 +02:00
parent a124869b2d
commit 68f4ab17a2

View File

@@ -5,7 +5,15 @@
name: password name: password
prompt: "ansible user password ? " prompt: "ansible user password ? "
private: true private: true
tasks: tasks:
- ansible.builtin.assert:
that:
- password | length > 14
- password is match('^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{14,}$') 
fail_msg: "no blank password !"
- name: warn people - name: warn people
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/motd path: /etc/motd
@@ -13,11 +21,6 @@
line: "Host is managed by ansible, manual interaction not recommended" line: "Host is managed by ansible, manual interaction not recommended"
state: present state: present
- ansible.builtin.assert:
that:
- password | length > 14
fail_msg: "no blank password !"
- name: history - name: history
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/history path: /etc/history