vn-ansible/roles/debian-once/tasks/root.yml

15 lines
431 B
YAML
Raw Normal View History

- name: Generate a random root password
set_fact:
root_password: "{{ lookup('password', '/dev/null length=18 chars=ascii_letters,digits') }}"
- name: Save the root password to a file
copy:
content: "{{ root_password }}\n"
dest: /root/root_password.txt
owner: root
group: root
mode: '0600'
- name: Change root password
user:
name: root
password: "{{ root_password | password_hash('sha512') }}"