2017-06-13 16:32:22 +00:00
|
|
|
# We start with firewall turned off
|
|
|
|
|
|
|
|
- name: Turn off Windows Firewall again
|
|
|
|
win_firewall:
|
|
|
|
profiles: [ Domain, Private, Public ]
|
|
|
|
state: disabled
|
|
|
|
register: firewall_off_again
|
|
|
|
|
|
|
|
- name: Test firewall_off_again
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_off_again is not changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- not firewall_off_again.Domain.enabled
|
|
|
|
- not firewall_off_again.Private.enabled
|
|
|
|
- not firewall_off_again.Public.enabled
|
|
|
|
|
|
|
|
- name: Turn on Windows Firewall on Public
|
|
|
|
win_firewall:
|
|
|
|
profiles: [ Public ]
|
|
|
|
state: enabled
|
|
|
|
register: firewall_public_on
|
|
|
|
|
|
|
|
- name: Test firewall_public_on
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_public_on is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- not firewall_public_on.Domain.enabled
|
|
|
|
- not firewall_public_on.Private.enabled
|
|
|
|
- firewall_public_on.Public.enabled
|
|
|
|
|
|
|
|
|
|
|
|
- name: Turn on Windows Firewall on Public again
|
|
|
|
win_firewall:
|
|
|
|
profiles: [ Public ]
|
|
|
|
state: enabled
|
|
|
|
register: firewall_public_on_again
|
|
|
|
|
|
|
|
- name: Test firewall_public_on_again (normal mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_public_on_again is not changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- not firewall_public_on_again.Domain.enabled
|
|
|
|
- not firewall_public_on_again.Private.enabled
|
|
|
|
- firewall_public_on_again.Public.enabled
|
|
|
|
when: not in_check_mode
|
|
|
|
|
|
|
|
- name: Test firewall_public_on_again (check-mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_public_on_again is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- not firewall_public_on_again.Domain.enabled
|
|
|
|
- not firewall_public_on_again.Private.enabled
|
|
|
|
- firewall_public_on_again.Public.enabled
|
|
|
|
when: in_check_mode
|
|
|
|
|
|
|
|
|
|
|
|
# On purpose not a list
|
|
|
|
- name: Turn on Windows Firewall on Domain
|
|
|
|
win_firewall:
|
|
|
|
profiles: Domain
|
|
|
|
state: enabled
|
|
|
|
register: firewall_domain_on
|
|
|
|
|
|
|
|
- name: Test firewall_domain_on (normal mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_domain_on is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- firewall_domain_on.Domain.enabled
|
|
|
|
- not firewall_domain_on.Private.enabled
|
|
|
|
- firewall_domain_on.Public.enabled
|
|
|
|
when: not in_check_mode
|
|
|
|
|
|
|
|
- name: Test firewall_domain_on (check-mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_domain_on is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- firewall_domain_on.Domain.enabled
|
|
|
|
- not firewall_domain_on.Private.enabled
|
|
|
|
- not firewall_domain_on.Public.enabled
|
|
|
|
when: in_check_mode
|
|
|
|
|
|
|
|
|
|
|
|
- name: Turn on Windows Firewall on Domain again
|
|
|
|
win_firewall:
|
|
|
|
profiles: [ Domain ]
|
|
|
|
state: enabled
|
|
|
|
register: firewall_domain_on_again
|
|
|
|
|
|
|
|
- name: Test firewall_domain_on_again (normal mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_domain_on_again is not changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- firewall_domain_on.Domain.enabled
|
|
|
|
- not firewall_domain_on.Private.enabled
|
|
|
|
- firewall_domain_on.Public.enabled
|
|
|
|
when: not in_check_mode
|
|
|
|
|
|
|
|
- name: Test firewall_domain_on_again (check-mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_domain_on_again is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- firewall_domain_on.Domain.enabled
|
|
|
|
- not firewall_domain_on.Private.enabled
|
|
|
|
- not firewall_domain_on.Public.enabled
|
|
|
|
when: in_check_mode
|
|
|
|
|
|
|
|
|
|
|
|
- name: Turn on Windows Firewall
|
|
|
|
win_firewall:
|
|
|
|
profiles: [ Domain, Private, Public ]
|
|
|
|
state: enabled
|
|
|
|
register: firewall_on
|
|
|
|
|
|
|
|
- name: Test firewall_on
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_on is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- firewall_on.Domain.enabled
|
|
|
|
- firewall_on.Private.enabled
|
|
|
|
- firewall_on.Public.enabled
|
|
|
|
|
|
|
|
|
|
|
|
# On purpose no profiles added
|
|
|
|
- name: Turn on Windows Firewall again
|
|
|
|
win_firewall:
|
|
|
|
state: enabled
|
|
|
|
register: firewall_on_again
|
|
|
|
|
|
|
|
- name: Test firewall_on_again (normal mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_on_again is not changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- firewall_on_again.Domain.enabled
|
|
|
|
- firewall_on_again.Private.enabled
|
|
|
|
- firewall_on_again.Public.enabled
|
|
|
|
when: not in_check_mode
|
|
|
|
|
|
|
|
- name: Test firewall_on_again (check-mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_on_again is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- firewall_on_again.Domain.enabled
|
|
|
|
- firewall_on_again.Private.enabled
|
|
|
|
- firewall_on_again.Public.enabled
|
|
|
|
when: in_check_mode
|
|
|
|
|
|
|
|
|
|
|
|
# On purpose no profiles added
|
|
|
|
- name: Turn off Windows Firewall
|
|
|
|
win_firewall:
|
|
|
|
state: disabled
|
|
|
|
register: firewall_off2
|
|
|
|
|
|
|
|
- name: Test firewall_off2 (normal mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_off2 is changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- not firewall_off2.Domain.enabled
|
|
|
|
- not firewall_off2.Private.enabled
|
|
|
|
- not firewall_off2.Public.enabled
|
|
|
|
when: not in_check_mode
|
|
|
|
|
|
|
|
- name: Test firewall_off2 (check-mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_off2 is not changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- not firewall_off2.Domain.enabled
|
|
|
|
- not firewall_off2.Private.enabled
|
|
|
|
- not firewall_off2.Public.enabled
|
|
|
|
when: in_check_mode
|
|
|
|
|
|
|
|
|
|
|
|
- name: Turn off Windows Firewall again
|
|
|
|
win_firewall:
|
|
|
|
profiles: [ Domain, Private, Public ]
|
|
|
|
state: disabled
|
|
|
|
register: firewall_off2_again
|
|
|
|
|
|
|
|
- name: Test firewall_off2_again (normal mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- firewall_off2_again is not changed
|
2017-06-13 16:32:22 +00:00
|
|
|
- not firewall_off2_again.Domain.enabled
|
|
|
|
- not firewall_off2_again.Private.enabled
|
|
|
|
- not firewall_off2_again.Public.enabled
|