Skip to content

Commit 6d0c7c2

Browse files
fix: Simplified test security policy match playbook
1 parent a496036 commit 6d0c7c2

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
---
22
# Runs test security-policy-match based on the given parameters
33

4+
- name: Set Test XML
5+
set_fact:
6+
test_xml: |
7+
<test>
8+
<security-policy-match>
9+
<source>{{ source_ip }}</source>
10+
<destination>{{ destination_ip }}</destination>
11+
<application>{{ application | default('ssl') }}</application>
12+
<protocol>6</protocol>
13+
<destination-port>443</destination-port>
14+
</security-policy-match>
15+
</test>
16+
17+
- name: Print the test parameters
18+
debug:
19+
msg: "{{ test_xml }}"
20+
421
- name: Test the Current Security policy
522
block:
623
- name: Test the current status of the security policy using all parameters
@@ -10,16 +27,7 @@
1027
username: "{{ provider.username }}"
1128
password: "{{ provider.password }}"
1229
serial_number: "{{ item.serial }}"
13-
cmd: |
14-
<test>
15-
<security-policy-match>
16-
<source>{{ source_ip }}</source>
17-
<destination>{{ destination_ip }}</destination>
18-
<application>{{ application }}</application>
19-
<protocol>{{ protocol }}</protocol>
20-
<destination-port>{{ destination_port }}</destination-port>
21-
</security-policy-match>
22-
</test>
30+
cmd: "{{ test_xml }}"
2331
cmd_is_xml: true
2432
register: security_policy_match_result
2533
rescue:
@@ -30,19 +38,13 @@
3038
username: "{{ provider.username }}"
3139
password: "{{ provider.password }}"
3240
serial_number: "{{ item.serial }}"
33-
cmd: |
34-
<test>
35-
<security-policy-match>
36-
<source>{{ source_ip }}</source>
37-
<destination>{{ destination_ip }}</destination>
38-
<application>ssl</application>
39-
<protocol>6</protocol>
40-
<destination-port>443</destination-port>
41-
</security-policy-match>
42-
</test>
41+
cmd: "{{ test_xml }}"
4342
cmd_is_xml: true
4443
register: security_policy_match_result
4544

45+
- debug:
46+
msg: "{{ security_policy_match_result }}"
47+
4648
- name: Set the policy match result
4749
set_fact:
4850
matches_existing_policy: "{{ security_policy_match_result | panos_op_policy_match_result_to_bool }}"

0 commit comments

Comments
 (0)