Discussion:
[ansible-project] hide variable in loop execution
g***@privax.com
2015-07-23 13:31:34 UTC
Permalink
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
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d2530b88-cbca-428a-bc23-fb3e81e8d7bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-23 13:45:14 UTC
Permalink
you can set no_log: true on the task to prevent the output and logging.
--
Brian Coca
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8k%2B%2BpbE-XN_kpStnMxhz1Ga_jshCTTLb_8JF%2BF3mP5n8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
g***@privax.com
2015-07-23 14:10:21 UTC
Permalink
That did the trick, thanks a lot!
Post by Brian Coca
you can set no_log: true on the task to prevent the output and logging.
--
Brian Coca
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/44c37278-cc18-4450-a776-80c5ca5e2ad5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...