-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade_ha_px10.yml
95 lines (85 loc) · 3.29 KB
/
upgrade_ha_px10.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
---
# upgrade_ha.yml - PAN-OS HA pair upgrade playbook.
#
# Description
# ===========
#
# Upgrades a PAN-OS HA pair to the specified version. Upgrade must be a single step (i.e. 8.1.7 to 8.1.12). For major
# version upgrades requiring a base image to be downloaded to the device prior to performing the upgrade, see the
# 'download_panos_image.yml' playbook.
#
# This playbook requires connection details for the two members of the HA pair to be specified in the variables
# 'primary_ip_address', 'secondary_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 HA pair. See `host_vars/ha_pair.yml` for sample definition of host variables.
#
# version: Version to install.
#
# See the VARS section of the playbook for additional customization options.
#
# Default run:
#
# $ ansible-playbook -i inventory upgrade_ha.yml --extra-vars "target=ha_pair version=9.0.3-h3"
#
# Notes
# =====
#
# HA pairs with preemption enabled are not supported by this playbook.
- 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) }}'
# backup_config - Create a backup of the currently running config before upgrading on both devices.
backup_config: true
# backup_filename - Filename for running config backup.
backup_filename: 'ansible-backup-{{ ansible_date_time.date }}.xml'
# pause_mid_upgrade - Optionally pause for additional verification during upgrade. This playbook will perform
# basic checks for HA status and session sync, but this will wait for manual verification before
# upgrading the secondary firewall.
pause_mid_upgrade: False
tasks:
- name: Install target PAN-OS version and restart (secondary)
paloaltonetworks.panos.panos_software:
provider: '{{ secondary }}'
version: '{{ version }}'
download: false
restart: true
register: installresult
until: installresult is not failed
delay: 10
- name: Pause for restart
pause:
seconds: 30
- name: Chassis ready (secondary)
paloaltonetworks.panos.panos_op:
provider: '{{ secondary }}'
cmd: 'show chassis-ready'
changed_when: false
register: result
until: result is not failed and (result.stdout | from_json).response.result == 'yes'
retries: 30
delay: 60
- name: State sync check (secondary)
paloaltonetworks.panos.panos_op:
provider: '{{ secondary }}'
cmd: 'show high-availability state'
register: secondary_state_sync
retries: 10
delay: 30
until: ( secondary_state_sync.stdout | from_json).response.result.group["local-info"].state == 'passive' and
( secondary_state_sync.stdout | from_json).response.result.group["local-info"]["state-sync"] == 'Complete'