Ansible playbook for change the root user password

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}}

2 thoughts on “Ansible playbook for change the root user password

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s