# htpasswd module for nginx question

**URL:** <https://forum.ansible.com/t/htpasswd-module-for-nginx-question/17044>\
**Category:** Ansible Project\
**Created:** [December 13, 2014, 1:34am UTC](https://forum.ansible.com/t/htpasswd-module-for-nginx-question/17044 "2014-12-13T01:34:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Goodall](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@John\_Goodall](https://forum.ansible.com/u/John_Goodall)\
**Post date:** [December 13, 2014, 1:34am UTC](https://forum.ansible.com/t/htpasswd-module-for-nginx-question/17044/1 "2014-12-13T01:34:42Z")

</div>

I run the following on the command line:

$ htpasswd -nb demo demo  
demo:$apr1$nB6zClk/$SXB.D6Tr81L2Q6zxLulEg.

Then in my playbook I have the following:

htpasswd: path=/tmp/.htpasswd name=demo password=$apr1$nB6zClk/$SXB.D6Tr81L2Q6zxLulEg.

And the resulting file (/tmp/.htpasswd), the entry for demo is different than what was in the playbook, and authentication through nginx fails. My understanding was that the apr\_md5\_crypt was the default for the htpasswd module.

Any ideas what I am doing wrong?

thanks.

---

<div class="post-metadata">

**Author:** ![iprok](https://avatars.discourse-cdn.com/v4/letter/i/dfb087/32.png) [@iprok](https://forum.ansible.com/u/iprok)\
**Post date:** [December 14, 2014, 7:18pm UTC](https://forum.ansible.com/t/htpasswd-module-for-nginx-question/17044/2 "2014-12-14T19:18:28Z")

</div>

pass clear text password using password= parameter. For example  
htpasswd: path=/tmp/.htpasswd name=demo password=demo

And resulting password string can be different when using same password because of using salt.

---

<div class="post-metadata">

**Author:** ![John\_Goodall](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@John\_Goodall](https://forum.ansible.com/u/John_Goodall)\
**Post date:** [December 15, 2014, 1:22pm UTC](https://forum.ansible.com/t/htpasswd-module-for-nginx-question/17044/3 "2014-12-15T13:22:23Z")

</div>

Ah, I see - thanks. That wasnt clear to me from the documentation. Is there any way to pass a password not in clear text?

Thanks.  
-john

---

<div class="post-metadata">

**Author:** ![iprok](https://avatars.discourse-cdn.com/v4/letter/i/dfb087/32.png) [@iprok](https://forum.ansible.com/u/iprok)\
**Post date:** [December 15, 2014, 1:24pm UTC](https://forum.ansible.com/t/htpasswd-module-for-nginx-question/17044/4 "2014-12-15T13:24:48Z")

</div>

To pass it - I think is would be tricky. But you can store it in encrypted form using ansible-vault.

---

<div class="post-metadata">

**Author:** ![John\_Goodall](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@John\_Goodall](https://forum.ansible.com/u/John_Goodall)\
**Post date:** [December 15, 2014, 2:09pm UTC](https://forum.ansible.com/t/htpasswd-module-for-nginx-question/17044/5 "2014-12-15T14:09:06Z")

</div>

Great, I had forgotten about vault, thanks again.
