Use Ansible to backup config

Showing results for 
Search instead for 
Did you mean: 

Use Ansible to backup config

L1 Bithead


is there a simple way to backup config using Ansible ?




L5 Sessionator

Not yet, this is still a pending feature request for the Ansible role:


I'd recommend commenting or thumbs-up'ing the original issue opener, so that Palo Alto Networks has a way to see how many users want a particular issue / feature request.

L1 Bithead

Hi @IarnoPagliani 


A bit late on the topic but I created a playbook sometime ago to perform backups of PAN FWs

Had to reuse it today and I can confirm it still works ( Python3 + Ansible 2.9.7 )


I also put a playbook to push local configs to devices from the same inventory but I guess you already have that



Is there any reason to use this insted of the built in backup function with scp?

Hi @sylvaing 


I'm also using Ansible 2.9.7


However the play fails at the "Extract API Key from XML Output" task with error "fatal: [x.x.x.x]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'content'\n\n"


No changes done on the playbook besides referencing my host group


Thank you


Upgrading to python 3 doesn't help as well

Hi @hbalzac 


If you only manage PAN firewalls , no.

However if you are dealing with a multivendor setup , using ansible as a central point of automation ( backup , config , ops ) can simplify your life.

Hi @jmolefe 


Interresting , this might be related to the format of the API KEY response from the firewall. I ve been dealing with 8.1 and 9.0 atm when creating this playbook mostly. What version are you running on your firewall ?





Hi @sylvaing 


Firewalls run 8.1 and Panorama is on 9.0 and both fail. Please see format of API response below


<response status="success">

Hi @jmolefe 


Can you -vvv you ansible-playbook command and show me the output of the Generate API Key task ?

I bet it is not formated as mine and that must be the reason why the API key cannot be extracted.  Or maybe one ansible module is missing.

Let s figure that out,





Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!