# Best practice to change root pass

**URL:** <https://forum.ansible.com/t/best-practice-to-change-root-pass/25141>\
**Category:** Ansible Project\
**Created:** [July 31, 2017, 9:10pm UTC](https://forum.ansible.com/t/best-practice-to-change-root-pass/25141 "2017-07-31T21:10:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Cure](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@Daniel\_Cure](https://forum.ansible.com/u/Daniel_Cure)\
**Post date:** [July 31, 2017, 9:10pm UTC](https://forum.ansible.com/t/best-practice-to-change-root-pass/25141/1 "2017-07-31T21:10:01Z")

</div>

hi peole thanks so much for your kindly help. Im mew here and i hope to help so much. Im just learning ansible and im new to this but im going to learn fast. My question is, do you what is the best method for changing root password in linux redhat env. Thanks a lot dear people.

Sorry my bad english, regards.

---

<div class="post-metadata">

**Author:** ![Cev\_Ing](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@Cev\_Ing](https://forum.ansible.com/u/Cev_Ing)\
**Post date:** [August 1, 2017, 7:43am UTC](https://forum.ansible.com/t/best-practice-to-change-root-pass/25141/2 "2017-08-01T07:43:38Z")

</div>

Probably the user module.

[http://docs.ansible.com/ansible/latest/user\_module.html](http://docs.ansible.com/ansible/latest/user_module.html)

But the problem with the user module is, that it is quite hard the debug.

You can try this:

- name: Update Root password  
user:  
name: root  
uid: 0  
gid: 0  
shell: /bin/bash  
password: “{{root\_password\_hash}}”  
home: /root  
update\_password: always  
state: present

Set the variable root\_passoword\_hash in a vault file.  
[http://docs.ansible.com/ansible/latest/playbooks\_vault.html](http://docs.ansible.com/ansible/latest/playbooks_vault.html)

---

<div class="post-metadata">

**Author:** ![Daniel\_Cure](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@Daniel\_Cure](https://forum.ansible.com/u/Daniel_Cure)\
**Post date:** [August 4, 2017, 3:38am UTC](https://forum.ansible.com/t/best-practice-to-change-root-pass/25141/3 "2017-08-04T03:38:58Z")

</div>

Hello my dear friend. I really appreciate what you did. I’m so glad and I hope could help in this group as soon as learn… Thanks you so much for your kindly help.

Please let me know if I can help with anything.

Regards
