# Hiding varibles in with\_items

**URL:** <https://forum.ansible.com/t/hiding-varibles-in-with-items/16405>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 2, 2014, 2:42pm UTC](https://forum.ansible.com/t/hiding-varibles-in-with-items/16405 "2014-10-02T14:42:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [October 2, 2014, 2:42pm UTC](https://forum.ansible.com/t/hiding-varibles-in-with-items/16405/1 "2014-10-02T14:42:56Z")

</div>

We want to with\_items over a set of variables with private data in them,  
like AWS keys. This causes us to get output like

&nbsp;&nbsp;TASK: [ourtask | template .s3cfg] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
&nbsp;&nbsp;changed: [host1] =\> (item={'access\_key': 'my-access-id', 'secret\_key': 'my-secret-key', 'name': 'me'})  
&nbsp;&nbsp;changed: [host1] =\> (item={'access\_key': 'your-access-id', 'secret\_key': 'your-secret-key', 'name': 'you'})  
&nbsp;&nbsp;changed: [host2] =\> (item={'access\_key': 'my-access-id', 'secret\_key': 'my-secret-key', 'name': 'me'})  
&nbsp;&nbsp;changed: [host2] =\> (item={'access\_key': 'your-access-id', 'secret\_key': 'your-secret-key', 'name': 'you'})

...except the values (my-secret-key, your-secret-key, etc) are actually  
printed there. Is there a way to tell Ansible that these variables are  
secret and not to print them? (We're not using Vault, but our own way to  
isolate private vars; but [http://docs.ansible.com/playbooks\_vault.html](http://docs.ansible.com/playbooks_vault.html)  
didn't seem to imply that this would be different if we were. Although  
that could be a cool way to do it, if Ansible keeps track of what  
variables were set by files that came from Vault.)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [October 2, 2014, 3:07pm UTC](https://forum.ansible.com/t/hiding-varibles-in-with-items/16405/2 "2014-10-02T15:07:06Z")

</div>

I would recommend setting ‘no\_log: True’ on your task. Then the contents of the items will be suppressed. We do this with ‘secrets’ and with tasks that loop over data sets that have overly large strings or values.

There is some additional information at:

[http://docs.ansible.com/faq.html#how-do-i-keep-secret-data-in-my-playbook](http://docs.ansible.com/faq.html#how-do-i-keep-secret-data-in-my-playbook)

---

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [October 2, 2014, 3:17pm UTC](https://forum.ansible.com/t/hiding-varibles-in-with-items/16405/3 "2014-10-02T15:17:12Z")

</div>

> I would recommend setting 'no\_log: True' on your task. Then the contents  
> of the items will be suppressed. We do this with 'secrets' and with tasks  
> that loop over data sets that have overly large strings or values.
> 
> There is some additional information at:
> 
> [http://docs.ansible.com/faq.html#how-do-i-keep-secret-data-in-my-playbook](http://docs.ansible.com/faq.html#how-do-i-keep-secret-data-in-my-playbook)

Ah, cool. If that's only in 1.8, we'll pick it up when that comes out. Thanks!

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 2, 2014, 3:41pm UTC](https://forum.ansible.com/t/hiding-varibles-in-with-items/16405/4 "2014-10-02T15:41:44Z")

</div>

Before 1.8, it will prevent syslogging, but not display in the app’s stdout.
