From c770d657f3c565f9da5759145efd5c86ba4f2eab Mon Sep 17 00:00:00 2001 From: Jacky Hu Date: Thu, 20 Apr 2017 22:43:25 +0800 Subject: [PATCH] Enable url lookup without a proxy By introducing a use_proxy parameter to url lookup, the usage of proxy is totally controllable. (cherry picked from commit 11e4e5123532344740c61f1069b53387df290b9b) from #23811 --- lib/ansible/plugins/lookup/url.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/lookup/url.py b/lib/ansible/plugins/lookup/url.py index 135256d1dcb..13a33b96e92 100644 --- a/lib/ansible/plugins/lookup/url.py +++ b/lib/ansible/plugins/lookup/url.py @@ -37,12 +37,13 @@ class LookupModule(LookupBase): validate_certs = kwargs.get('validate_certs', True) split_lines = kwargs.get('split_lines', True) + use_proxy = kwargs.get('use_proxy', True) ret = [] for term in terms: display.vvvv("url lookup connecting to %s" % term) try: - response = open_url(term, validate_certs=validate_certs) + response = open_url(term, validate_certs=validate_certs, use_proxy=use_proxy) except HTTPError as e: raise AnsibleError("Received HTTP error for %s : %s" % (term, str(e))) except URLError as e: