how limit uri module retries output

1,074 views
Skip to first unread message

Giri Chintala

unread,
Feb 17, 2016, 9:05:12 PM2/17/16
to Ansible Project
I am using uri module with retries until: (result | success), 

ansible is logging whole HTTP Request information including username and password.   

is there way to disable logging on retries failures? no_log=true is not helping here. 

Here is my task
uri:
    user: "{{admin_username}}"
    password: "{{admin_password}}"
    validate_certs: no
   register: result
   until: "(result | success) and (result.status == 200)"
   retries: 40
   delay: 30
   with_items: "{{clusters_elb_facts.elbs}}"
   ignore_errors: "true"  
   no_log: True 



Log
FAILED - RETRYING: TASK: wait for api to come up (39 retries left). Result was: {'invocation': {'module_name': u'uri', u'module_args': {u'directory_mode': None, u'force': None, u'remote_src': None, u'follow_redirects': u'safe', u'body_format': u'raw', u'owner': None, u'follow': False, u'group': None, u'serole': None, u'content': None, u'setype': None, u'status_code': [200], u'return_content': False, u'method': u'GET', u'body': None, u'dest': None, u'selevel': None, u'force_basic_auth': False, u'removes': None, u'user': u'api-user', u'regexp': None, u'password': u'abcd1234', u'src': None, u'_ansible_no_log': True, u'url': u'https://internal-ism-a-dev-1021862535.us-east-1.elb.amazonaws.com:156721/api/aliveness-test/digital', u'backup': None, u'seuser': None, u'creates': None, u'delimiter': None, u'mode': None, u'timeout': 30, u'validate_certs': False}}, u'msg': u'Unable to resolve the host name given.', u'failed': True}

Giri Chintala

unread,
Feb 18, 2016, 10:03:53 PM2/18/16
to Ansible Project
   no_log: True is working as expected if i remove retires.. 

not sure if it is a bug with retires or is there any other workaround?

uri:
    user: "{{admin_username}}"
    password: "{{admin_password}}"
    validate_certs: no
   register: result
   with_items: "{{clusters_elb_facts.elbs}}"
   ignore_errors: "true"  
   no_log: True

Giri Chintala

unread,
Feb 18, 2016, 10:50:08 PM2/18/16
to Ansible Project
i think i found the root cause. below code from line number 413 @task_executor.py  should be split to two statements. 

display.display("FAILED - RETRYING: %s (%d retries left). Result was: %s" % (self._task, retries-attempt, result), color=C.COLOR_DEBUG)
to 

display.display("FAILED - RETRYING: %s (%d retries left)., color=C.COLOR_DEBUG)
display.debug("Result was: %s" % (self._task, retries-attempt, result), color=C.COLOR_DEBUG)

Brian Coca

unread,
Feb 24, 2016, 12:07:29 PM2/24/16
to ansible...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages