You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
654 B
13 lines
654 B
---
|
|
- name: Generate & set random password for root
|
|
ansible.builtin.user:
|
|
name: root
|
|
create_home: false
|
|
# The rounds & salt MUST be set in the password_hash function if you don't want the task
|
|
# to return 'changed' every time the playbook runs, updating the /etc/passwd file each time. Fun!
|
|
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/password_hash_filter.html
|
|
password: "{{ lookup('ansible.builtin.password', password_dir + '/' + ansible_hostname + '/root_password', length=20) | password_hash('sha512', rounds=16384, salt=8008135) }}"
|
|
update_password: always
|
|
become: true
|
|
become_method: sudo
|