Skip to content

Commit 39839a4

Browse files
feat: ADd single device upgrade playbook
1 parent 17cee9e commit 39839a4

File tree

8 files changed

+67
-86
lines changed

8 files changed

+67
-86
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ For more information, contact Palo Alto Networks Professional Services.
1010

1111
## Configure the PAN-OS Ansible EE image as an execution environment
1212

13-
![img.png](docs/create_execution_env.png)
13+
**Image**: ghcr.io/paloaltonetworks/ansible-panos-upgrade-example:latest
14+
![img.png](docs/ee.png)
1415

1516
### Setup a Project
1617
![img.png](docs/create_project.png)

docs/create_execution_env.png

-34 KB
Binary file not shown.

docs/ee.png

34.1 KB
Loading

roles/run_readiness_checks/meta/argument_specs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ argument_specs:
2222
password:
2323
type: "str"
2424
required: true
25-
description: "Firewall login password"
25+
description: "Firewall login password"
26+
exit_on_fail:
27+
type: "bool"
28+
required: false
29+
default: false
30+
description: "Playbook fails if any readiness check fails."

roles/run_readiness_checks/tasks/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@
3434
{{ panos_upgrade_assurance_passed_readiness_checks | length }}
3535
total_failed_readiness_checks: |
3636
{{ panos_upgrade_assurance_failed_readiness_checks | length }}
37+
38+
- name: FAIL - Readiness checks failed
39+
ansible.builtin.fail:
40+
msg: "Readiness checks failed and exit_on_fail is set to true. Aborting."
41+
when: panos_upgrade_assurance_failed_readiness_checks | length > 0

test_complete_upgrade.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

test_run_readiness_playbook.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
username: "{{ username | default(lookup('env', 'ANSIBLE_NET_USERNAME')) }}"
1111
password: "{{ password | default(lookup('env', 'ANSIBLE_NET_PASSWORD')) }}"
1212
serial_number: "{{ serialno }}"
13+
exit_on_fail: true
1314

1415
roles:
1516
- run_readiness_checks

test_single_device_upgrade.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
- hosts: all
3+
connection: local
4+
gather_facts: true
5+
name: Example snapshot comparison playbook
6+
7+
vars:
8+
provider:
9+
ip_address: "{{ panorama_ip_address }}"
10+
username: "{{ username | default(lookup('env', 'ANSIBLE_NET_USERNAME')) }}"
11+
password: "{{ password | default(lookup('env', 'ANSIBLE_NET_PASSWORD')) }}"
12+
serial_number: "{{ serialno }}"
13+
snapshot_directory: "./snapshots"
14+
15+
roles:
16+
17+
##################
18+
# Check Device #
19+
##################
20+
21+
- role: run_readiness_checks
22+
name: READINESS - Check the device can be upgraded
23+
24+
##################
25+
# TAKE SNAPSHOTS #
26+
##################
27+
28+
- role: take_snapshot
29+
name: SNAPSHOTS - Take the pre-upgrade snapshot
30+
vars:
31+
snapshot_filename: "pre_upgrade_snapshot_{{ serialno }}"
32+
33+
############
34+
# UPGRADE #
35+
############
36+
37+
- role: upgrade
38+
name: UPGRADES - Upgrade the Device
39+
40+
############################
41+
# Check State post-upgrade #
42+
############################
43+
44+
- role: take_snapshot
45+
name: SNAPSHOTS - Take the post-upgrade snapshot
46+
vars:
47+
snapshot_filename: "post_upgrade_snapshot_{{ serialno }}"
48+
49+
- role: snapshot_report_from_files
50+
name: REPORTS - Compare the two snapshot reports from the main
51+
vars:
52+
left_snapshot: "pre_upgrade_snapshot_{{ serialno }}"
53+
right_snapshot: "post_upgrade_snapshot_{{ serialno }}"

0 commit comments

Comments
 (0)