feat: passwords will be randomly generated

This commit is contained in:
xpk
2019-02-20 17:34:24 +08:00
parent bd6547324d
commit 83e9f4dc5d
2 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -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 }}"
+2
View File
@@ -0,0 +1,2 @@
plain_pass: "{{ lookup('password', '/dev/null chars=ascii_letters,digits,hexdigits length=15') }}"
hashed_pass: "{{ plain_pass | password_hash('sha512') }}"