- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
09-13-2024 06:50 AM
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>"
09-13-2024 01:26 PM
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>
09-13-2024 07:57 AM
09-13-2024 01:26 PM
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>
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!