Pages

Wednesday, November 28, 2018

Ansible :How to reset user password in Linux servers

How to reset user password in Linux servers

1) Generate the encryted password and enter required password. It will generate encrypted password, which we have to use in below playbook.

# python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"
password ...

Note the encryption for below playbook.

2) Put ecrypted password in playbook

--- # This is to reset password of account 'Sitadmin' on Linux servers
- hosts: password_reset_servers
  user: Account
  become: yes
  connection: ssh
  tasks:
  - name: Change Sitadmin password
    user: name=Sitadmin update_password=always  password=$6$rounds=656000$DFemtIsZ.6q0F5$dJGl7/vJs4bYsSlEo64.fQKGgpwwzunFvPj5QChPZslV49b4Swex8TFmud9jbCNseHO.eySszUHLzkhn7/K0e1

No comments:

Post a Comment

Ansible :How to reset user password in Linux servers

How to reset user password in Linux servers 1) Generate the encryted password and enter required password. It will generate encrypted pas...