diff --git a/Ansible/asserts/display.yml b/Ansible/asserts/display.yml index aa77cff..a94a769 100644 --- a/Ansible/asserts/display.yml +++ b/Ansible/asserts/display.yml @@ -4,3 +4,6 @@ - name: Display variable env_proxy_all.port ansible.builtin.debug: var: env_proxy_all.port +- name: Display variable env_proxy_all.no_proxy + ansible.builtin.debug: + var: env_proxy_all.no_proxy diff --git a/Ansible/asserts/proxy.yml b/Ansible/asserts/proxy.yml index dfcc491..d79e6d8 100644 --- a/Ansible/asserts/proxy.yml +++ b/Ansible/asserts/proxy.yml @@ -11,3 +11,17 @@ that: - env_proxy.port is not defined or env_proxy.port is string or env_proxy.port is integer fail_msg: "La variable n'existe pas ou est de mauvais type !" +- name: Test variable env_proxy.no_proxy + ansible.builtin.assert: + that: + - env_proxy.no_proxy is defined + - env_proxy.no_proxy | type_debug == 'list' + fail_msg: "La variable n'existe pas ou est de mauvais type !" +- name: Test variable env_proxy.no_proxy is a list of string + ansible.builtin.assert: + that: + - no_proxy is string + fail_msg: "La variable n'existe pas ou est de mauvais type !" + loop: "{{ env_proxy.no_proxy }}" + loop_control: + loop_var: no_proxy diff --git a/Ansible/inventory/group_vars/all/proxy.yml b/Ansible/inventory/group_vars/all/proxy.yml index c86d03d..4a2825b 100644 --- a/Ansible/inventory/group_vars/all/proxy.yml +++ b/Ansible/inventory/group_vars/all/proxy.yml @@ -2,3 +2,4 @@ env_proxy_all: host: "{{ env_proxy.host }}" port: "{{ env_proxy.port | default(3128) }}" + no_proxy: "{{ env_proxy.no_proxy }}" diff --git a/doc.md b/doc.md index 166391b..639cd34 100644 --- a/doc.md +++ b/doc.md @@ -17,12 +17,18 @@ to make network connections to network services outside its own network. |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **host**
`mandatory`
**Type:** [`domainname`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | The proxy server’s address.
Specifies the hostname of proxy server to enable proxy server access to all of your HTTP(s) requests. .
**Example:** proxy.silique.fr | | **port**
`mandatory`
**Type:** [`port`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | The proxy server's port.
**Default:** 3128 | +| **no_proxy**
`mandatory`, `multiple`
**Type:** [`domainname`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | Exclude proxy server.
Network address(es), network address range(s) and domains to exclude from using the proxy when initiating connection(s). .
**Examples:** 192.168.1.1, 192.168.10.0/24, www.silique.fr, .internal.silique.fr | # Example with mandatories variables ``` env_proxy: host: proxy.silique.fr + no_proxy: + - 192.168.1.1 + - 192.168.10.0/24 + - www.silique.fr + - .internal.silique.fr ``` # Example with all variables @@ -31,4 +37,9 @@ env_proxy: env_proxy: host: proxy.silique.fr port: '3128' + no_proxy: + - 192.168.1.1 + - 192.168.10.0/24 + - www.silique.fr + - .internal.silique.fr ```