diff --git a/lib/ansible/module_utils/network/eos/eos.py b/lib/ansible/module_utils/network/eos/eos.py index a548f13934..c9162f9d0a 100644 --- a/lib/ansible/module_utils/network/eos/eos.py +++ b/lib/ansible/module_utils/network/eos/eos.py @@ -50,6 +50,7 @@ eos_provider_spec = { 'auth_pass': dict(no_log=True, fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS'])), 'use_ssl': dict(default=True, type='bool'), + 'use_proxy': dict(default=True, type='bool'), 'validate_certs': dict(default=True, type='bool'), 'timeout': dict(type='int'), @@ -292,10 +293,11 @@ class Eapi: headers = {'Content-Type': 'application/json-rpc'} timeout = self._module.params['timeout'] + use_proxy = self._module.params['provider']['use_proxy'] response, headers = fetch_url( self._module, self._url, data=data, headers=headers, - method='POST', timeout=timeout + method='POST', timeout=timeout, use_proxy=use_proxy ) if headers['status'] != 200: diff --git a/lib/ansible/module_utils/network/nxos/nxos.py b/lib/ansible/module_utils/network/nxos/nxos.py index 5c563097b7..ab9ac0b919 100644 --- a/lib/ansible/module_utils/network/nxos/nxos.py +++ b/lib/ansible/module_utils/network/nxos/nxos.py @@ -50,6 +50,7 @@ nxos_provider_spec = { 'ssh_keyfile': dict(fallback=(env_fallback, ['ANSIBLE_NET_SSH_KEYFILE'])), 'use_ssl': dict(type='bool'), + 'use_proxy': dict(default=True, type='bool'), 'validate_certs': dict(type='bool'), 'timeout': dict(type='int'), @@ -316,6 +317,7 @@ class Nxapi: headers = {'Content-Type': 'application/json'} result = list() timeout = self._module.params['timeout'] + use_proxy = self._module.params['provider']['use_proxy'] for req in requests: if self._nxapi_auth: @@ -323,7 +325,7 @@ class Nxapi: response, headers = fetch_url( self._module, self._url, data=req, headers=headers, - timeout=timeout, method='POST' + timeout=timeout, method='POST', use_proxy=use_proxy ) self._nxapi_auth = headers.get('set-cookie') diff --git a/lib/ansible/utils/module_docs_fragments/eos.py b/lib/ansible/utils/module_docs_fragments/eos.py index 93ec891c26..872f55f448 100644 --- a/lib/ansible/utils/module_docs_fragments/eos.py +++ b/lib/ansible/utils/module_docs_fragments/eos.py @@ -120,6 +120,13 @@ options: on personally controlled sites using self-signed certificates. If the transport argument is not eapi, this value is ignored. choices: ['yes', 'no'] + use_proxy: + description: + - If C(no), the environment variables C(http_proxy) and C(https_proxy) will be ignored. + default: 'yes' + choices: ['yes', 'no'] + version_added: "2.5" + notes: - For more information on using Ansible to manage Arista EOS devices see U(https://www.ansible.com/ansible-arista-networks). diff --git a/lib/ansible/utils/module_docs_fragments/nxos.py b/lib/ansible/utils/module_docs_fragments/nxos.py index 5e66fd2c2c..37b84375f1 100644 --- a/lib/ansible/utils/module_docs_fragments/nxos.py +++ b/lib/ansible/utils/module_docs_fragments/nxos.py @@ -95,6 +95,13 @@ options: met either by individual arguments or values in this dict. required: false default: null + use_proxy: + description: + - If C(no), the environment variables C(http_proxy) and C(https_proxy) will be ignored. + default: 'yes' + choices: ['yes', 'no'] + version_added: "2.5" + notes: - For more information on using Ansible to manage Cisco devices see U(https://www.ansible.com/ansible-cisco). """