309 lines
8 KiB
YAML
309 lines
8 KiB
YAML
|
---
|
||
|
- name: ensure we fail when proxy is not set with bypass
|
||
|
win_inet_proxy:
|
||
|
bypass: abc
|
||
|
register: fail_bypass
|
||
|
failed_when: 'fail_bypass.msg != "missing parameter(s) required by ''bypass'': proxy"'
|
||
|
|
||
|
- name: ensure we fail if an invalid protocol is specified
|
||
|
win_inet_proxy:
|
||
|
proxy:
|
||
|
fail1: fail
|
||
|
fail2: fail
|
||
|
register: fail_proxy
|
||
|
failed_when: 'fail_proxy.msg != "Invalid keys found in proxy: fail1, fail2. Valid keys are http, https, ftp, socks."'
|
||
|
|
||
|
- name: ensure we fail if invalid value is set
|
||
|
win_inet_proxy:
|
||
|
proxy: fake=proxy
|
||
|
register: fail_invalid
|
||
|
failed_when: fail_invalid.msg != "Unknown error when trying to set auto_config_url '', proxy 'fake=proxy', or bypass ''"
|
||
|
|
||
|
- name: ensure we fail if an invalid connection is set
|
||
|
win_inet_proxy:
|
||
|
connection: Fake Connection
|
||
|
register: fail_connection
|
||
|
failed_when: fail_connection.msg != "The connection 'Fake Connection' does not exist."
|
||
|
|
||
|
- name: check proxy is still set to Direct access
|
||
|
win_inet_proxy_info:
|
||
|
register: fail_invalid_actual
|
||
|
failed_when: fail_invalid_actual.proxy == 'fake=proxy'
|
||
|
|
||
|
- name: disable auto detect (check)
|
||
|
win_inet_proxy:
|
||
|
auto_detect: no
|
||
|
register: disable_auto_detect_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of disable auto detect (check)
|
||
|
win_inet_proxy_info:
|
||
|
register: disable_auto_detect_actual_check
|
||
|
|
||
|
- name: assert disable auto detect (check)
|
||
|
assert:
|
||
|
that:
|
||
|
- disable_auto_detect_check is changed
|
||
|
- disable_auto_detect_actual_check.auto_detect
|
||
|
|
||
|
- name: disable auto detect
|
||
|
win_inet_proxy:
|
||
|
auto_detect: no
|
||
|
register: disable_auto_detect
|
||
|
|
||
|
- name: get result of disable auto detect
|
||
|
win_inet_proxy_info:
|
||
|
register: disable_auto_detect_actual
|
||
|
|
||
|
- name: assert disable auto detect
|
||
|
assert:
|
||
|
that:
|
||
|
- disable_auto_detect is changed
|
||
|
- not disable_auto_detect_actual.auto_detect
|
||
|
|
||
|
- name: disable auto detect (idempotent)
|
||
|
win_inet_proxy:
|
||
|
auto_detect: no
|
||
|
register: disable_auto_detect_again
|
||
|
|
||
|
- name: assert disable auto detect (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not disable_auto_detect_again is changed
|
||
|
|
||
|
- name: set auto config url
|
||
|
win_inet_proxy:
|
||
|
auto_config_url: http://ansible.com/proxy.pac
|
||
|
register: set_auto_url
|
||
|
|
||
|
- name: get result of set auto config url
|
||
|
win_inet_proxy_info:
|
||
|
register: set_auto_url_actual
|
||
|
|
||
|
- name: assert set auto config url
|
||
|
assert:
|
||
|
that:
|
||
|
- set_auto_url is changed
|
||
|
- set_auto_url_actual.auto_detect
|
||
|
- set_auto_url_actual.auto_config_url == 'http://ansible.com/proxy.pac'
|
||
|
|
||
|
- name: set auto config url (idempotent)
|
||
|
win_inet_proxy:
|
||
|
auto_config_url: http://ansible.com/proxy.pac
|
||
|
register: set_auto_url_again
|
||
|
|
||
|
- name: set auto config url (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not set_auto_url_again is changed
|
||
|
|
||
|
- name: set a proxy using a string
|
||
|
win_inet_proxy:
|
||
|
proxy: proxyhost
|
||
|
register: proxy_str
|
||
|
|
||
|
- name: get result of set a proxy using a string
|
||
|
win_inet_proxy_info:
|
||
|
register: proxy_str_actual
|
||
|
|
||
|
- name: assert set a proxy using a string
|
||
|
assert:
|
||
|
that:
|
||
|
- proxy_str is changed
|
||
|
- proxy_str_actual.auto_detect
|
||
|
- proxy_str_actual.auto_config_url == None
|
||
|
- proxy_str_actual.proxy == 'proxyhost'
|
||
|
|
||
|
- name: set a proxy using a string (idempotent)
|
||
|
win_inet_proxy:
|
||
|
proxy: proxyhost
|
||
|
register: proxy_str_again
|
||
|
|
||
|
- name: assert set a proxy using a string (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not proxy_str_again is changed
|
||
|
|
||
|
- name: change a proxy and set bypass
|
||
|
win_inet_proxy:
|
||
|
proxy: proxyhost:8080
|
||
|
bypass:
|
||
|
- abc
|
||
|
- def
|
||
|
- <local>
|
||
|
register: change_proxy
|
||
|
|
||
|
- name: get result of change a proxy and set bypass
|
||
|
win_inet_proxy_info:
|
||
|
register: change_proxy_actual
|
||
|
|
||
|
- name: assert change a proxy and set bypass
|
||
|
assert:
|
||
|
that:
|
||
|
- change_proxy is changed
|
||
|
- change_proxy_actual.proxy == 'proxyhost:8080'
|
||
|
- change_proxy_actual.bypass == 'abc;def;<local>'
|
||
|
|
||
|
- name: change a proxy and set bypass (idempotent)
|
||
|
win_inet_proxy:
|
||
|
proxy: proxyhost:8080
|
||
|
bypass: abc,def,<local>
|
||
|
register: change_proxy_again
|
||
|
|
||
|
- name: assert change a proxy and set bypass (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not change_proxy_again is changed
|
||
|
|
||
|
- name: change bypass list
|
||
|
win_inet_proxy:
|
||
|
proxy: proxyhost:8080
|
||
|
bypass:
|
||
|
- abc
|
||
|
- <-loopback>
|
||
|
register: change_bypass
|
||
|
|
||
|
- name: get reuslt of change bypass list
|
||
|
win_inet_proxy_info:
|
||
|
register: change_bypass_actual
|
||
|
|
||
|
- name: assert change bypass list
|
||
|
assert:
|
||
|
that:
|
||
|
- change_bypass is changed
|
||
|
- change_bypass_actual.proxy == 'proxyhost:8080'
|
||
|
- change_bypass_actual.bypass == 'abc;<-loopback>'
|
||
|
|
||
|
- name: remove proxy without options
|
||
|
win_inet_proxy:
|
||
|
register: remove_proxy
|
||
|
|
||
|
- name: get result of remove proxy without options
|
||
|
win_inet_proxy_info:
|
||
|
register: remove_proxy_actual
|
||
|
|
||
|
- name: assert remove proxy without options
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_proxy is changed
|
||
|
- remove_proxy_actual.auto_detect == True
|
||
|
- remove_proxy_actual.auto_config_url == None
|
||
|
- remove_proxy_actual.proxy == None
|
||
|
- remove_proxy_actual.bypass == None
|
||
|
|
||
|
- name: remove proxy without options (idempotent)
|
||
|
win_inet_proxy:
|
||
|
register: remove_proxy_again
|
||
|
|
||
|
- name: assert remove proxy without options (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not remove_proxy_again is changed
|
||
|
|
||
|
- name: set proxy with dictionary
|
||
|
win_inet_proxy:
|
||
|
proxy:
|
||
|
http: proxy:8080
|
||
|
https: proxy:8443
|
||
|
ftp: proxy:821
|
||
|
socks: proxy:888
|
||
|
register: set_dict
|
||
|
|
||
|
- name: get result of set proxy with dictionary
|
||
|
win_inet_proxy_info:
|
||
|
register: set_dict_actual
|
||
|
|
||
|
- name: assert set proxy with dictionary
|
||
|
assert:
|
||
|
that:
|
||
|
- set_dict is changed
|
||
|
- set_dict_actual.proxy == 'http=proxy:8080;https=proxy:8443;ftp=proxy:821;socks=proxy:888'
|
||
|
|
||
|
- name: set proxy protocol with str
|
||
|
win_inet_proxy:
|
||
|
proxy: http=proxy:8080;https=proxy:8443;ftp=proxy:821;socks=proxy:888
|
||
|
register: set_str_protocol
|
||
|
|
||
|
- name: assert set proxy protocol with str
|
||
|
assert:
|
||
|
that:
|
||
|
- not set_str_protocol is changed
|
||
|
|
||
|
- name: remove proxy with empty string
|
||
|
win_inet_proxy:
|
||
|
proxy: ''
|
||
|
register: remove_empty_str
|
||
|
|
||
|
- name: get result of remove proxy with empty string
|
||
|
win_inet_proxy_info:
|
||
|
register: remove_empty_str_actual
|
||
|
|
||
|
- name: assert remove proxy with empty string
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_empty_str is changed
|
||
|
- remove_empty_str_actual.proxy == None
|
||
|
|
||
|
- name: create test phonebook entry
|
||
|
win_phonebook_entry:
|
||
|
name: Ansible Test Dialup
|
||
|
device_type: pppoe
|
||
|
device_name: WAN Miniport (PPPOE)
|
||
|
framing_protocol: ppp
|
||
|
options:
|
||
|
- remote_default_gateway
|
||
|
- require_pap
|
||
|
- internet
|
||
|
type: broadband
|
||
|
state: present
|
||
|
|
||
|
- name: set proxy for specific connection
|
||
|
win_inet_proxy:
|
||
|
connection: Ansible Test Dialup
|
||
|
auto_detect: no
|
||
|
auto_config_url: proxy.com
|
||
|
proxy: proxyhost:8080
|
||
|
bypass: proxyhost
|
||
|
register: set_connection
|
||
|
|
||
|
- name: get result for set proxy for specific connection
|
||
|
win_inet_proxy_info:
|
||
|
connection: Ansible Test Dialup
|
||
|
register: set_connection_actual
|
||
|
|
||
|
- name: get result for LAN connection proxy
|
||
|
win_inet_proxy_info:
|
||
|
register: set_connection_lan_actual
|
||
|
|
||
|
- name: assert set proxy for specific connection
|
||
|
assert:
|
||
|
that:
|
||
|
- set_connection is changed
|
||
|
- set_connection_actual.auto_detect == False
|
||
|
- set_connection_actual.auto_config_url == 'proxy.com'
|
||
|
- set_connection_actual.proxy == 'proxyhost:8080'
|
||
|
- set_connection_actual.bypass == 'proxyhost'
|
||
|
- set_connection_lan_actual.auto_detect == True
|
||
|
- set_connection_lan_actual.auto_config_url == None
|
||
|
- set_connection_lan_actual.proxy == None
|
||
|
- set_connection_lan_actual.bypass == None
|
||
|
|
||
|
- name: remove proxy for specific connection
|
||
|
win_inet_proxy:
|
||
|
connection: Ansible Test Dialup
|
||
|
register: remove_connection
|
||
|
|
||
|
- name: get result of remove proxy for specific connection
|
||
|
win_inet_proxy_info:
|
||
|
connection: Ansible Test Dialup
|
||
|
register: remove_connection_actual
|
||
|
|
||
|
- name: assert remove proxy for specific connection
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_connection is changed
|
||
|
- remove_connection_actual.auto_detect == True
|
||
|
- remove_connection_actual.auto_config_url == None
|
||
|
- remove_connection_actual.proxy == None
|
||
|
- remove_connection_actual.bypass == None
|