-
Notifications
You must be signed in to change notification settings - Fork 5
/
apply-zones.yml
66 lines (59 loc) · 1.75 KB
/
apply-zones.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
61
62
63
64
65
66
# REQUIREMENTS
# pip install pan-python
# pip install pandevice
# pip install xmltodict
# ansible-galaxy install paloaltonetworks.paloaltonetworks
# https://www.bountysource.com/issues/59738537-certificate-verify-failed
# set verify to disable in the virtual environment
---
- hosts: panos
connection: local
gather_facts: no
vars:
erase: false
vars_files:
- ./vars/default_vars.yml
- ./credentials/pan_credentials.yml
# roles:
# - role: paloaltonetworks.paloaltonetworks
tasks:
- block:
- name: add zone trust
paloaltonetworks.panos.panos_zone:
provider:
ip_address: "{{ ansible_host }}"
username: "{{ PAN_USERNAME }}"
password: "{{ PAN_PASSWORD }}"
zone: trust
mode: layer3
state: present
- name: add zone untrust
paloaltonetworks.panos.panos_zone:
provider:
ip_address: "{{ ansible_host }}"
username: "{{ PAN_USERNAME }}"
password: "{{ PAN_PASSWORD }}"
zone: untrust
mode: layer3
state: present
when: zone_state == "add"
- block:
- name: remove zone trust
paloaltonetworks.panos.panos_zone:
provider:
ip_address: "{{ ansible_host }}"
username: "{{ PAN_USERNAME }}"
password: "{{ PAN_PASSWORD }}"
zone: trust
mode: layer3
state: absent
- name: remove zone untrust
paloaltonetworks.panos.panos_zone:
provider:
ip_address: "{{ ansible_host }}"
username: "{{ PAN_USERNAME }}"
password: "{{ PAN_PASSWORD }}"
zone: untrust
mode: layer3
state: absent
when: zone_state == "remove"