2015-05-18 22:44:29 +02:00
|
|
|
---
|
2017-05-09 05:32:11 +02:00
|
|
|
- name: network setup
|
|
|
|
cs_network:
|
|
|
|
name: "{{ cs_firewall_network }}"
|
|
|
|
network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService
|
|
|
|
network_domain: example.com
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
register: net
|
|
|
|
- name: verify network setup
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- net is successful
|
2017-05-09 05:32:11 +02:00
|
|
|
|
2019-02-14 23:44:50 +01:00
|
|
|
- name: setup instance to get network in implementation state
|
|
|
|
cs_instance:
|
|
|
|
name: "{{ cs_resource_prefix }}-vm-cs-firewall"
|
|
|
|
template: "{{ cs_common_template }}"
|
|
|
|
service_offering: "{{ cs_common_service_offering }}"
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
networks:
|
|
|
|
- "{{ net.name }}"
|
|
|
|
register: instance
|
|
|
|
until: instance is success
|
2019-02-23 09:39:42 +01:00
|
|
|
retries: 20
|
2019-02-14 23:44:50 +01:00
|
|
|
delay: 5
|
|
|
|
- name: verify instance setup
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- instance is successful
|
|
|
|
|
2017-05-09 05:32:11 +02:00
|
|
|
- name: public ip address setup
|
|
|
|
cs_ip_address:
|
|
|
|
network: ansible test
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
register: ip_address
|
|
|
|
- name: verify public ip address setup
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- ip_address is successful
|
2017-05-09 05:32:11 +02:00
|
|
|
|
|
|
|
- name: set ip address as fact
|
|
|
|
set_fact:
|
|
|
|
cs_firewall_ip_address: "{{ ip_address.ip_address }}"
|
|
|
|
|
2015-05-18 22:44:29 +02:00
|
|
|
- name: setup 80
|
|
|
|
cs_firewall:
|
|
|
|
port: 80
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify setup
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
2015-05-18 22:44:29 +02:00
|
|
|
|
|
|
|
- name: setup 5300
|
|
|
|
cs_firewall:
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
protocol: udp
|
|
|
|
start_port: 5300
|
|
|
|
end_port: 5333
|
2017-11-17 20:17:42 +01:00
|
|
|
cidrs:
|
|
|
|
- 1.2.3.0/24
|
|
|
|
- 4.5.6.0/24
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify setup
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
2015-05-18 22:44:29 +02:00
|
|
|
|
|
|
|
- name: setup all
|
|
|
|
cs_firewall:
|
|
|
|
network: "{{ cs_firewall_network }}"
|
|
|
|
protocol: all
|
|
|
|
type: egress
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify setup
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
2015-05-18 22:44:29 +02:00
|
|
|
|
|
|
|
- name: test fail if missing params
|
|
|
|
action: cs_firewall
|
|
|
|
register: fw
|
|
|
|
ignore_errors: true
|
|
|
|
- name: verify results of fail if missing params
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is failed
|
2017-10-03 16:17:12 +02:00
|
|
|
- "fw.msg == 'one of the following is required: ip_address, network'"
|
2015-05-18 22:44:29 +02:00
|
|
|
|
2017-05-09 05:32:11 +02:00
|
|
|
- name: test fail if missing params
|
2015-05-18 22:44:29 +02:00
|
|
|
cs_firewall:
|
2017-05-09 05:32:11 +02:00
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
ignore_errors: true
|
2017-05-09 05:32:11 +02:00
|
|
|
- name: verify results of fail if missing params
|
2015-05-18 22:44:29 +02:00
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is failed
|
2017-05-09 05:32:11 +02:00
|
|
|
- "fw.msg == \"missing required argument for protocol 'tcp': start_port or end_port\""
|
2015-05-18 22:44:29 +02:00
|
|
|
|
|
|
|
- name: test fail if missing params network egress
|
|
|
|
cs_firewall:
|
|
|
|
type: egress
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
ignore_errors: true
|
|
|
|
- name: verify results of fail if missing params ip_address
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is failed
|
2017-10-03 16:17:12 +02:00
|
|
|
- "fw.msg == 'one of the following is required: ip_address, network'"
|
2015-05-18 22:44:29 +02:00
|
|
|
|
2017-05-26 12:19:47 +02:00
|
|
|
- name: test present firewall rule ingress 80 in check mode
|
|
|
|
cs_firewall:
|
|
|
|
port: 80
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
register: fw
|
|
|
|
check_mode: true
|
|
|
|
- name: verify results of present firewall rule ingress 80 in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2017-05-26 12:19:47 +02:00
|
|
|
|
2015-05-18 22:44:29 +02:00
|
|
|
- name: test present firewall rule ingress 80
|
|
|
|
cs_firewall:
|
|
|
|
port: 80
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
- name: verify results of present firewall rule ingress 80
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0"
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "tcp"
|
|
|
|
- fw.start_port == 80
|
|
|
|
- fw.end_port == 80
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
|
|
|
- name: test present firewall rule ingress 80 idempotence
|
|
|
|
cs_firewall:
|
|
|
|
port: 80
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
- name: verify results of present firewall rule ingress 80 idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is not changed
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0"
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "tcp"
|
|
|
|
- fw.start_port == 80
|
|
|
|
- fw.end_port == 80
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
2017-05-26 12:19:47 +02:00
|
|
|
- name: test present firewall rule ingress 5300 in check mode
|
|
|
|
cs_firewall:
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
protocol: udp
|
|
|
|
start_port: 5300
|
|
|
|
end_port: 5333
|
2017-11-17 20:17:42 +01:00
|
|
|
cidrs:
|
|
|
|
- 1.2.3.0/24
|
|
|
|
- 4.5.6.0/24
|
2017-05-26 12:19:47 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
register: fw
|
|
|
|
check_mode: true
|
|
|
|
- name: verify results of present firewall rule ingress 5300 in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2017-05-26 12:19:47 +02:00
|
|
|
|
2015-05-18 22:44:29 +02:00
|
|
|
- name: test present firewall rule ingress 5300
|
|
|
|
cs_firewall:
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
protocol: udp
|
|
|
|
start_port: 5300
|
|
|
|
end_port: 5333
|
2017-11-17 20:17:42 +01:00
|
|
|
cidrs:
|
|
|
|
- 1.2.3.0/24
|
|
|
|
- 4.5.6.0/24
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
- name: verify results of present firewall rule ingress 5300
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidr == "1.2.3.0/24,4.5.6.0/24"
|
|
|
|
- fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "udp"
|
|
|
|
- fw.start_port == 5300
|
|
|
|
- fw.end_port == 5333
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
|
|
|
- name: test present firewall rule ingress 5300 idempotence
|
|
|
|
cs_firewall:
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
protocol: udp
|
|
|
|
start_port: 5300
|
|
|
|
end_port: 5333
|
2017-11-17 20:17:42 +01:00
|
|
|
cidrs:
|
|
|
|
- 1.2.3.0/24
|
|
|
|
- 4.5.6.0/24
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
- name: verify results of present firewall rule ingress 5300 idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is not changed
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidr == "1.2.3.0/24,4.5.6.0/24"
|
|
|
|
- fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "udp"
|
|
|
|
- fw.start_port == 5300
|
|
|
|
- fw.end_port == 5333
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
2017-05-26 12:19:47 +02:00
|
|
|
- name: test present firewall rule egress all in check mode
|
|
|
|
cs_firewall:
|
|
|
|
network: "{{ cs_firewall_network }}"
|
|
|
|
protocol: all
|
|
|
|
type: egress
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
register: fw
|
|
|
|
check_mode: true
|
|
|
|
- name: verify results of present firewall rule egress all in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2017-05-26 12:19:47 +02:00
|
|
|
|
2015-05-18 22:44:29 +02:00
|
|
|
- name: test present firewall rule egress all
|
|
|
|
cs_firewall:
|
|
|
|
network: "{{ cs_firewall_network }}"
|
|
|
|
protocol: all
|
|
|
|
type: egress
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
- name: verify results of present firewall rule egress all
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2018-07-08 00:51:46 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24"
|
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.network == "{{ cs_firewall_network }}"
|
|
|
|
- fw.protocol == "all"
|
|
|
|
- fw.type == "egress"
|
|
|
|
|
|
|
|
- name: test present firewall rule egress all idempotence
|
|
|
|
cs_firewall:
|
|
|
|
network: "{{ cs_firewall_network }}"
|
|
|
|
protocol: all
|
|
|
|
type: egress
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
- name: verify results of present firewall rule egress all idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is not changed
|
2018-07-08 00:51:46 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24"
|
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.network == "{{ cs_firewall_network }}"
|
|
|
|
- fw.protocol == "all"
|
|
|
|
- fw.type == "egress"
|
|
|
|
|
2017-05-26 12:19:47 +02:00
|
|
|
- name: test absent firewall rule ingress 80 in check mode
|
|
|
|
cs_firewall:
|
|
|
|
port: 80
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
check_mode: true
|
|
|
|
- name: verify results of absent firewall rule ingress 80 in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2017-05-26 12:19:47 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0"
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ]
|
2017-05-26 12:19:47 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "tcp"
|
|
|
|
- fw.start_port == 80
|
|
|
|
- fw.end_port == 80
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
2015-05-18 22:44:29 +02:00
|
|
|
- name: test absent firewall rule ingress 80
|
|
|
|
cs_firewall:
|
|
|
|
port: 80
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify results of absent firewall rule ingress 80
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0"
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "tcp"
|
|
|
|
- fw.start_port == 80
|
|
|
|
- fw.end_port == 80
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
|
|
|
- name: test absent firewall rule ingress 80 idempotence
|
|
|
|
cs_firewall:
|
|
|
|
port: 80
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify results of absent firewall rule ingress 80 idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is not changed
|
2015-05-18 22:44:29 +02:00
|
|
|
|
2017-05-26 12:19:47 +02:00
|
|
|
- name: test absent firewall rule ingress 5300 in check mode
|
|
|
|
cs_firewall:
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
protocol: udp
|
|
|
|
start_port: 5300
|
|
|
|
end_port: 5333
|
2017-11-17 20:17:42 +01:00
|
|
|
cidrs:
|
|
|
|
- 1.2.3.0/24
|
|
|
|
- 4.5.6.0/24
|
2017-05-26 12:19:47 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
check_mode: true
|
|
|
|
- name: verify results of absent firewall rule ingress 5300 in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidr == "1.2.3.0/24,4.5.6.0/24"
|
|
|
|
- fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ]
|
2017-05-26 12:19:47 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "udp"
|
|
|
|
- fw.start_port == 5300
|
|
|
|
- fw.end_port == 5333
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
2015-05-18 22:44:29 +02:00
|
|
|
- name: test absent firewall rule ingress 5300
|
|
|
|
cs_firewall:
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
protocol: udp
|
|
|
|
start_port: 5300
|
|
|
|
end_port: 5333
|
2017-11-17 20:17:42 +01:00
|
|
|
cidrs:
|
|
|
|
- 1.2.3.0/24
|
|
|
|
- 4.5.6.0/24
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify results of absent firewall rule ingress 5300
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2017-11-17 20:17:42 +01:00
|
|
|
- fw.cidr == "1.2.3.0/24,4.5.6.0/24"
|
|
|
|
- fw.cidrs == [ '1.2.3.0/24', '4.5.6.0/24' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.ip_address == "{{ cs_firewall_ip_address }}"
|
|
|
|
- fw.protocol == "udp"
|
|
|
|
- fw.start_port == 5300
|
|
|
|
- fw.end_port == 5333
|
|
|
|
- fw.type == "ingress"
|
|
|
|
|
|
|
|
- name: test absent firewall rule ingress 5300 idempotence
|
|
|
|
cs_firewall:
|
|
|
|
ip_address: "{{ cs_firewall_ip_address }}"
|
|
|
|
protocol: udp
|
|
|
|
start_port: 5300
|
|
|
|
end_port: 5333
|
2017-11-17 20:17:42 +01:00
|
|
|
cidrs:
|
|
|
|
- 1.2.3.0/24
|
|
|
|
- 4.5.6.0/24
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify results of absent firewall rule ingress 5300 idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is not changed
|
2015-05-18 22:44:29 +02:00
|
|
|
|
2017-05-26 12:19:47 +02:00
|
|
|
- name: test absent firewall rule egress all in check mode
|
|
|
|
cs_firewall:
|
|
|
|
network: "{{ cs_firewall_network }}"
|
|
|
|
protocol: all
|
|
|
|
type: egress
|
|
|
|
state: absent
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
register: fw
|
|
|
|
check_mode: true
|
|
|
|
- name: verify results of absent firewall rule egress all in check mode
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2018-07-08 00:51:46 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24"
|
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ]
|
2017-05-26 12:19:47 +02:00
|
|
|
- fw.network == "{{ cs_firewall_network }}"
|
|
|
|
- fw.protocol == "all"
|
|
|
|
- fw.type == "egress"
|
|
|
|
|
2015-05-18 22:44:29 +02:00
|
|
|
- name: test absent firewall rule egress all
|
|
|
|
cs_firewall:
|
|
|
|
network: "{{ cs_firewall_network }}"
|
|
|
|
protocol: all
|
|
|
|
type: egress
|
|
|
|
state: absent
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
register: fw
|
|
|
|
- name: verify results of absent firewall rule egress all
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is changed
|
2018-07-08 00:51:46 +02:00
|
|
|
- fw.cidr == "0.0.0.0/0" or fw.cidr == "10.1.1.0/24"
|
|
|
|
- fw.cidrs == [ '0.0.0.0/0' ] or fw.cidrs == [ '10.1.1.0/24' ]
|
2015-05-18 22:44:29 +02:00
|
|
|
- fw.network == "{{ cs_firewall_network }}"
|
|
|
|
- fw.protocol == "all"
|
|
|
|
- fw.type == "egress"
|
|
|
|
|
|
|
|
- name: test absent firewall rule egress all idempotence
|
|
|
|
cs_firewall:
|
|
|
|
network: "{{ cs_firewall_network }}"
|
|
|
|
protocol: all
|
|
|
|
type: egress
|
2017-05-09 05:32:11 +02:00
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
2015-05-18 22:44:29 +02:00
|
|
|
state: absent
|
|
|
|
register: fw
|
|
|
|
- name: verify results of absent firewall rule egress all idempotence
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- fw is successful
|
|
|
|
- fw is not changed
|
2017-05-09 05:32:11 +02:00
|
|
|
|
2019-02-14 23:44:50 +01:00
|
|
|
- name: cleanup instance
|
|
|
|
cs_instance:
|
|
|
|
name: "{{ cs_resource_prefix }}-vm-cs-firewall"
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
state: expunged
|
|
|
|
register: instance
|
|
|
|
- name: verify instance cleanup
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- instance is successful
|
|
|
|
|
2017-05-09 05:32:11 +02:00
|
|
|
- name: network cleanup
|
|
|
|
cs_network:
|
|
|
|
name: "{{ cs_firewall_network }}"
|
|
|
|
zone: "{{ cs_common_zone_adv }}"
|
|
|
|
state: absent
|
|
|
|
register: net
|
|
|
|
- name: verify network cleanup
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 23:58:08 +01:00
|
|
|
- net is successful
|