# hide variable in loop execution

**URL:** <https://forum.ansible.com/t/hide-variable-in-loop-execution/18832>\
**Category:** Ansible Project\
**Created:** [July 23, 2015, 1:31pm UTC](https://forum.ansible.com/t/hide-variable-in-loop-execution/18832 "2015-07-23T13:31:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabor.debreczeni](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@gabor.debreczeni](https://forum.ansible.com/u/gabor.debreczeni)\
**Post date:** [July 23, 2015, 1:31pm UTC](https://forum.ansible.com/t/hide-variable-in-loop-execution/18832/1 "2015-07-23T13:31:34Z")

</div>

Hi All,

I’m running a loop for deploy multiple passwords into one config file:

- name: setup virtual router passwords  
replace: dest=/etc/keepalived/keepalived.conf  
regexp=‘{{ item.pattern }}’  
replace=‘{{ item.password }}’  
with\_items:
- { pattern: ‘virtual\_router\_id\_51\_password’, password: ‘{{ virtual\_router\_id\_51\_password }}’ }
- { pattern: ‘virtual\_router\_id\_52\_password’, password: ‘{{ virtual\_router\_id\_52\_password }}’ }
- { pattern: ‘virtual\_router\_id\_53\_password’, password: ‘{{ virtual\_router\_id\_53\_password }}’ }
- { pattern: ‘virtual\_router\_id\_54\_password’, password: ‘{{ virtual\_router\_id\_54\_password }}’ }
- { pattern: ‘virtual\_router\_id\_55\_password’, password: ‘{{ virtual\_router\_id\_55\_password }}’ }

My problem is that when I’m running the playbook it shows in the console output (and in the log) the passwords, which I definitely would like to avoid:

TASK: [setup virtual router passwords] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

changed: [lb1] =\> (item={‘pattern’: ‘virtual\_router\_id\_51\_password’, ‘password’: u’thisisthepassword’})

If I’m degrading this replace to a single replace (so deleting the with\_items completely) then it’s fine:

TASK: [setup virtual router passwords] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [lb1]

Is somebody have any idea why the passwords are showing up in the loop?

Thanks.  
Gabor

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 23, 2015, 1:45pm UTC](https://forum.ansible.com/t/hide-variable-in-loop-execution/18832/2 "2015-07-23T13:45:14Z")

</div>

you can set no\_log: true on the task to prevent the output and logging.

---

<div class="post-metadata">

**Author:** ![gabor.debreczeni](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@gabor.debreczeni](https://forum.ansible.com/u/gabor.debreczeni)\
**Post date:** [July 23, 2015, 2:10pm UTC](https://forum.ansible.com/t/hide-variable-in-loop-execution/18832/3 "2015-07-23T14:10:21Z")

</div>

That did the trick, thanks a lot!
