forked from PaloAltoNetworks/ansible-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fw_rules.yml
60 lines (56 loc) · 1.78 KB
/
fw_rules.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
57
58
59
60
---
# fw_rules.yml - Create security rules on a PAN-OS device.
#
# Description
# ===========
#
# Quick examples of how to use the 'panos_security_rule' module to create security rules on a PAN-OS device.
#
# 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_rules.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) }}'
tasks:
- name: Create first security rule
paloaltonetworks.panos.panos_security_rule:
provider: '{{ device }}'
rule_name: 'Prod SSH Inbound'
source_zone: ['untrust']
destination_zone: ['trust']
source_ip: ['any']
destination_ip: ['Prod-Instances']
application: ['ssh']
service: ['application-default']
action: 'allow'
tag_name: ['Prod']
commit: false
- name: Create second security rule
paloaltonetworks.panos.panos_security_rule:
provider: '{{ device }}'
rule_name: 'SI Inbound'
source_zone: ['untrust']
destination_zone: ['trust']
source_ip: ['any']
destination_ip: ['SI-Instances']
application: ['ssh', 'mysql']
service: ['application-default']
action: 'allow'
tag_name: ['SI']
commit: false