feat: passwords will be randomly generated
This commit is contained in:
+5
-1
@@ -8,7 +8,7 @@
|
|||||||
name: "{{ user.name }}"
|
name: "{{ user.name }}"
|
||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
groups: "{{ user.group }},ssh_access"
|
groups: "{{ user.group }},ssh_access"
|
||||||
password: "{{ user.pwhash }}"
|
password: "{{ hashed_pass }}"
|
||||||
|
|
||||||
- name: Add user to sudoers
|
- name: Add user to sudoers
|
||||||
lineinfile:
|
lineinfile:
|
||||||
@@ -18,3 +18,7 @@
|
|||||||
mode: 0440
|
mode: 0440
|
||||||
when: user.sudoers
|
when: user.sudoers
|
||||||
|
|
||||||
|
- name: Display generated password
|
||||||
|
debug:
|
||||||
|
msg: "Generated password for user: {{ plain_pass }}"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
plain_pass: "{{ lookup('password', '/dev/null chars=ascii_letters,digits,hexdigits length=15') }}"
|
||||||
|
hashed_pass: "{{ plain_pass | password_hash('sha512') }}"
|
||||||
Reference in New Issue
Block a user