Ansible OSPF Validation Error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ansible OSPF Validation Error

L0 Member

Hello, I am having an issue running an Ansible Playbook for OSPF. I get the following error below. If I go into the GUI, select the virtual-router "default" and simply select "ok" on the bottom, without making a change, it will validate successfully. Would someone be able to assist?

 

Palo VM-100
Software: 10.1.14-h2

 

@JimmyHolland have you encountered this before?

 

Palo Validation Error Message

Details

Validation Error:
network -> virtual-router -> default -> protocol -> ospf unexpected here
network -> virtual-router -> default -> protocol -> ospf is invalid
network -> virtual-router -> default -> protocol is invalid
network -> virtual-router is invalid
network is invalid
devices is invalid
Configuration is invalid


Ansible Playbook - 
---
- name: OSPF
hosts: localhost
connection: local

vars:
device:
ip_address: "10.245.255.241"
username: "<user>"
password: "<pass>"
virtual_router_name: "default"
ospf_area: "0.0.0.0"
network_interface: "ethernet1/1"
router_id: "10.10.10.101"

collections:
- paloaltonetworks.panos
- community.network.panos_set


tasks:
#Create OSPF Config
- name: OSPF
paloaltonetworks.panos.panos_config_element:
provider: "{{ device }}"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='default']/protocol/ospf"
element: >
"<enable>no</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>
<enable>yes</enable>"

 

1 accepted solution

Accepted Solutions

I found the issue, it was the quotes (") to start the element "<ospf> and ending </ospf>" that was causing the issue. 


Working ospf playbook:

---
- hosts: localhost
connection: local
gather_facts: False

vars:
provider:
ip_address: '10.245.255.241'
username: "user"
password: "pass"
device:
ip_address: '10.245.255.241'
username: "user"
password: "pass"

tasks:

- name: Create ospf details with config_element
paloaltonetworks.panos.panos_config_element:
provider: "{{ device }}"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='default']/protocol"
element: |
<ospf>
<enable>yes</enable>
<area>
<entry name="0.0.0.0">
<type>
<normal/>
</type>
<range>
<entry name="192.168.250.0/24">
<advertise/>
</entry>
</range>
<interface>
<entry name="ethernet1/1">
<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>192.168.0.1</router-id>
<allow-redist-default-route>no</allow-redist-default-route>
<rfc1583>no</rfc1583>
</ospf>

View solution in original post

2 REPLIES 2

L5 Sessionator
  • If you have a Red Hat paid subscription for Ansible, you can raise a case with them and they will triage it with Palo Alto Networks to get it fixed.
  • If you don't have a Red Hat paid subscription for Ansible, please raise the issue on the GitHub repository.
Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂

I found the issue, it was the quotes (") to start the element "<ospf> and ending </ospf>" that was causing the issue. 


Working ospf playbook:

---
- hosts: localhost
connection: local
gather_facts: False

vars:
provider:
ip_address: '10.245.255.241'
username: "user"
password: "pass"
device:
ip_address: '10.245.255.241'
username: "user"
password: "pass"

tasks:

- name: Create ospf details with config_element
paloaltonetworks.panos.panos_config_element:
provider: "{{ device }}"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='default']/protocol"
element: |
<ospf>
<enable>yes</enable>
<area>
<entry name="0.0.0.0">
<type>
<normal/>
</type>
<range>
<entry name="192.168.250.0/24">
<advertise/>
</entry>
</range>
<interface>
<entry name="ethernet1/1">
<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>192.168.0.1</router-id>
<allow-redist-default-route>no</allow-redist-default-route>
<rfc1583>no</rfc1583>
</ospf>

  • 1 accepted solution
  • 639 Views
  • 2 replies
  • 0 Likes
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!