Ansible playbook for change the root user password
Requirements:
- Need to create inventory files with list of hostnames
- Need to copy encrypted password from /etc/shadow or you can use perl script to generate. Then paste the password to YAML file below.
Syntax:-
$ ansible-playbook -i <inventory_file> <filename.yml>
Filename.yml contents
—
– hosts: all
become: yes
vars:
password: Copy the encrypted password values here
tasks:
– name: Change root password
user: name=root update_password=always password={{password}}