# Best solutions to prevent password/secret writing to log file

**URL:** <https://forum.ansible.com/t/best-solutions-to-prevent-password-secret-writing-to-log-file/4343>\
**Category:** Get Help\
**Created:** [March 12, 2024, 8:24pm UTC](https://forum.ansible.com/t/best-solutions-to-prevent-password-secret-writing-to-log-file/4343 "2024-03-12T20:24:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daemenseth](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/daemenseth/32/677_2.png) [@daemenseth](https://forum.ansible.com/u/daemenseth)\
**Post date:** [March 12, 2024, 8:24pm UTC](https://forum.ansible.com/t/best-solutions-to-prevent-password-secret-writing-to-log-file/4343/1 "2024-03-12T20:24:17Z")

</div>

I want to run a python from ansible and need to user a password in it.  
With default behavior you see the password in the logging.  
I know the option no\_log: true but the nI have no logging.  
I want the sdtout logging but not see the passwords

What is the best way to accomplish that?

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [March 13, 2024, 9:10am UTC](https://forum.ansible.com/t/best-solutions-to-prevent-password-secret-writing-to-log-file/4343/2 "2024-03-13T09:10:19Z")

</div>

Could you provide some more details regarding the task in question?

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [March 14, 2024, 6:40am UTC](https://forum.ansible.com/t/best-solutions-to-prevent-password-secret-writing-to-log-file/4343/3 "2024-03-14T06:40:25Z")

</div>

Hi,

A subsequent debug task with [loop\_control](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#limiting-loop-output-with-label) ?
