Configuring /modifying OSPF interface metric using ansible

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

Configuring /modifying OSPF interface metric using ansible

L1 Bithead

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!

1 accepted solution

Accepted Solutions

L5 Sessionator

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

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

View solution in original post

4 REPLIES 4

L5 Sessionator

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

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

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!

L5 Sessionator

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

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

Thank you so much Jimmy!
I missed the edit parameter in my playbook.

  • 1 accepted solution
  • 1892 Views
  • 4 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!