forked from PaloAltoNetworks/ansible-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fw_rule_survey.yml
56 lines (52 loc) · 1.63 KB
/
fw_rule_survey.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
# fw_rule_survey.yml - Add security rule via Ansible Tower survey.
#
# Description
# ===========
#
# This is similar to 'fw_rules.yml', but the variables can be overridden using the output of an Ansible Tower survey.
#
# This playbook requires connection details for the device to be specified in the variables 'ip_address', 'username',
# and 'password'. These may be defined as host variables (see `host_vars/firewall.yml` for an example) or
# extra vars.
#
# Modules Used
# ============
#
# panos_security_rule - https://paloaltonetworks.github.io/pan-os-ansible/modules/panos_security_rule.html
#
# Usage
# =====
#
# $ ansible-playbook -i inventory fw_rule_survey.yml
- hosts: '{{ target | default("firewall") }}'
connection: local
vars:
device:
ip_address: '{{ ip_address }}'
username: '{{ username | default(omit) }}'
password: '{{ password | default(omit) }}'
api_key: '{{ api_key | default(omit) }}'
rule_name: 'Survey Rule'
source_zone: 'trust'
source_ip: 'any'
destination_zone: 'untrust'
destination_ip: 'any'
application:
- 'any'
service:
- 'application-default'
tasks:
- name: Create security rule via extra_vars
paloaltonetworks.panos.panos_security_rule:
provider: '{{ device }}'
rule_name: '{{ rule_name }}'
source_zone: '{{ source_zone }}'
destination_zone: '{{ destination_zone }}'
source_ip: '{{ source_ip }}'
destination_ip: '{{ destination_ip }}'
application: '{{ application }}'
service: '{{ service }}'
action: 'allow'
tag_name: '{{ tag|default([]) }}'
commit: false