- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
01-23-2023 10:51 AM
Hi everyone,
Is there an ansible module that enables us to modify the ospf interface metric?
I looked up the panos ansible galaxy collection Version: 2.13.0 but I could not find anything relevant over there.
The only option I could find is to use the panos_config_element_module.
Thanks!
01-25-2023 04:47 AM
Hi @Prabhath, I was able to edit just the metric with this task:
- name: Change OSPF interface metric
paloaltonetworks.panos.panos_config_element:
provider: "{{ device }}"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='{{ virtual_router_name }}']/protocol/ospf/area/entry[@name='{{ ospf_area }}']/interface/entry[@name='{{ network_interface }}']/metric"
element: "<metric>{{ new_metric }}</metric>"
edit: true
Hope that helps
01-24-2023 01:47 AM
Hi @Prabhath, correct, there is no dedicated module today. Both panos_type_cmd and panos_config_element could be used. Here is an example of the latter, it does quite a few OSPF parameters rather than just the interface metric, but should give you an example to work from.
Hope that helps
01-24-2023 08:59 AM
Hi Jimmy,
I tried using the panos_config_element but I was not able to edit just the metric part of it. Is it possible to do so or do I have to remove the interface and then re-add the interface under ospf with the desired metric?
Thanks!
01-25-2023 04:47 AM
Hi @Prabhath, I was able to edit just the metric with this task:
- name: Change OSPF interface metric
paloaltonetworks.panos.panos_config_element:
provider: "{{ device }}"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='{{ virtual_router_name }}']/protocol/ospf/area/entry[@name='{{ ospf_area }}']/interface/entry[@name='{{ network_interface }}']/metric"
element: "<metric>{{ new_metric }}</metric>"
edit: true
Hope that helps
01-25-2023 10:18 AM
Thank you so much Jimmy!
I missed the edit parameter in my playbook.
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!