-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_vm-plugin_ha.yml
113 lines (99 loc) · 3.95 KB
/
install_vm-plugin_ha.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
# upgrade_vm-plugin_ha.yml - Upgrade the vm-plugin version on an HA pair of PAN-OS devices.
#
# Description
# ===========
#
# Install vm-series plugin version on an HA pair of PAN-OS vm-series devices.
#
# This playbook requires connection details for the device to be specified in the variables 'primary_ip_address', 'username',
# and 'password'. These may be defined as host variables (see `host_vars/ha_pair.yml` for an example) or
# extra vars.
#
# Usage
# =====
#
# Required Variables:
#
# target: Target PAN-OS device
# vm_plugin_file: Filename of the vm-series plugin to install
#
#
# Install the plugin on an ha pair of PAN-OS vm-series devices
#
# $ ansible-playbook -i inventory install_vm-plugin.yml --extra-vars "target=ha_pair vm_plugin_file=vm_series-2.1.6"
- hosts: '{{ target | default("ha_pair") }}'
connection: local
vars:
primary:
ip_address: '{{ primary_ip_address }}'
username: '{{ username | default(omit) }}'
password: '{{ password | default(omit) }}'
api_key: '{{ api_key | default(omit) }}'
secondary:
ip_address: '{{ secondary_ip_address }}'
username: '{{ username | default(omit) }}'
password: '{{ password | default(omit) }}'
api_key: '{{ api_key | default(omit) }}'
vm_plugin_file: '{{ vm_plugin_file }}'
tasks:
- name: Check vm-series plugins (primary)
paloaltonetworks.panos.panos_op:
provider: '{{ primary }}'
cmd: 'request plugins check'
- name: Download vm-series version (primary)
paloaltonetworks.panos.panos_op:
provider: '{{ primary }}'
cmd: 'request plugins download file {{ vm_plugin_file }}'
register: download
- name: Check plugin download result (primary)
paloaltonetworks.panos.panos_op:
provider: '{{ primary }}'
cmd: 'show jobs id {{ (download.stdout | from_json).response.result.job }}'
register: download_job
until: download_job is not failed and (download_job.stdout | from_json).response.result.job.status == 'FIN'
retries: 10
delay: 10
- name: Install vm-series plugin version (primary)
paloaltonetworks.panos.panos_op:
provider: '{{ primary }}'
cmd: 'request plugins install {{ vm_plugin_file }}'
register: install
- name: Check plugin install result (primary)
paloaltonetworks.panos.panos_op:
provider: '{{ primary }}'
cmd: 'show jobs id {{ (install.stdout | from_json).response.result.job }}'
register: install_job
until: install_job is not failed and (install_job.stdout | from_json).response.result.job.status == 'FIN'
retries: 10
delay: 10
- name: Check vm-series plugins (secondary)
paloaltonetworks.panos.panos_op:
provider: '{{ secondary }}'
cmd: 'request plugins check'
- name: Download vm-series version (secondary)
paloaltonetworks.panos.panos_op:
provider: '{{ secondary }}'
cmd: 'request plugins download file {{ vm_plugin_file }}'
register: download
- name: Check plugin download result (secondary)
paloaltonetworks.panos.panos_op:
provider: '{{ secondary }}'
cmd: 'show jobs id {{ (download.stdout | from_json).response.result.job }}'
register: download_job
until: download_job is not failed and (download_job.stdout | from_json).response.result.job.status == 'FIN'
retries: 10
delay: 10
- name: Install vm-series plugin version (secondary)
paloaltonetworks.panos.panos_op:
provider: '{{ secondary }}'
cmd: 'request plugins install {{ vm_plugin_file }}'
register: install
- name: Check plugin install result (secondary)
paloaltonetworks.panos.panos_op:
provider: '{{ secondary }}'
cmd: 'show jobs id {{ (install.stdout | from_json).response.result.job }}'
register: install_job
until: install_job is not failed and (install_job.stdout | from_json).response.result.job.status == 'FIN'
retries: 10
delay: 10