Adding interfaces to OSPF with Ansible?

Showing results for 
Show  only  | Search instead for 
Did you mean: 
Please sign in to see details of an important advisory in our Customer Advisories area.
Palo Alto Networks Approved
Palo Alto Networks Approved
Community Expert Verified
Community Expert Verified

Adding interfaces to OSPF with Ansible?

L0 Member


Now I am able to create l3 interfaces and add them to the VR by ansible. Now I want to add these interfaces to OSPF.

I found modules for configuring static routes, configure basic VR and OSPF parameters like administrative distances, for redistribution and for BGP.

But I found nothing to add interfaces to OSPF. Are the capabilities still missing to panos ansible support, or am I looking wrong?


L5 Sessionator

Hi @FalkSchoenfeld, you could consider using panos_config_element. There are various ways to get the XML API syntax, listed in one of the bullet points here. Below is an example for enabling OSPF, with some parameters including adding an interface in an OSPF area:

    - name: OSPF config
        provider: "{{ device }}"
        xpath: "/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='{{ virtual_router_name }}']/protocol"
        element: "<ospf><enable>yes</enable><area><entry name='{{ ospf_area }}'><type><normal/></type><interface><entry name='{{ network_interface }}'><bfd><profile>Inherit-vr-global-setting</profile></bfd><enable>yes</enable><passive>no</passive><gr-delay>10</gr-delay><metric>10</metric><priority>1</priority><hello-interval>10</hello-interval><dead-counts>4</dead-counts><retransmit-interval>5</retransmit-interval><transit-delay>1</transit-delay><link-type><broadcast/></link-type></entry></interface></entry></area><router-id>{{ router_id }}</router-id></ospf>"


Hope that helps

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂

L6 Presenter

Also the Ansible URI module can be used to script any tasks that palo alto has not created ansible functions but as @JimmyHolland  mentioned better use the build in functions when you have them as with the URI module you will need also use the correct HTTP headees, so things like like as this is another option to configure stuff together with  that was already shared to you. For operational commands that config ones Palo Alto is more easier to work with Ansible with the module .



If you got you answer please "Accept the solution"


  • 2 replies
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!