need help to define static route using ansible for next-vr...

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

need help to define static route using ansible for next-vr...

L1 Bithead

hi ,

 

i'm trying to create static route with next hop type as a "next-vr" , and as a interface "None" in ansible. but seems like i'm getting an error for nexthop and interface...

 

sample playbook:

  - name: Create route to aws tunnel-1
    panos_static_route:
          provider: '{{ provider }}'
          name: "Route {{ item.id }} to {{ vendor_name }}"
          destination: '{{ item.vpc_net }}'
          interface: 'None'
          nexthop: 'next-vr'
          nexthop_type: 'none'
          virtual_router: 'SR1'

 

getting below error:

{"ansible_loop_var": "item", "changed": false, "item": {"id": 1, "vpc_net": "20.0.0.0/24"}, "msg": "Failed create: Route 1 to ansible-test -> interface 'None' is not a valid reference\n Route 1 to ansible-test -> interface is invalid"}

 

here is the original module for panos_static_route on ansible docx...

https://ansible-pan.readthedocs.io/en/latest/modules/panos_static_route_module.html

 

can you please let me know what i'm misisng here, it works absolutely fine with GUI...

 

thanks...!!

1 accepted solution

Accepted Solutions

L5 Sessionator

Hi @Bhargav_2784,

 

Per the docs (by the way, for your bookmarks, the current docs are https://paloaltonetworks.github.io/pan-os-ansible not https://ansible-pan.readthedocs.io) you only have to make a couple of changes:

  • nexthop should be the name of the VR which is the next hop, which per your code is probably not 'next-vr' but something else?
  • nexthop_type should not be 'none', it should be the string 'next-vr', per the docs (https://paloaltonetworks.github.io/pan-os-ansible/modules/panos_static_route_module.html)
  • virtual_router should be the VR into which you are placing this static route
  • interface does not need to be defined at all, comment it out or remove it

An example from your code:

 

  - name: Create route to aws tunnel-1
    panos_static_route:
          provider: '{{ provider }}'
          name: "Route {{ item.id }} to {{ vendor_name }}"
          destination: '{{ item.vpc_net }}'
          #interface: 'None'
          nexthop: '{{ your-next-vr }}'
          nexthop_type: 'next-vr'
          virtual_router: '{{ the-vr-requiring-the-route }}'

 

 

Hope this helps!

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

View solution in original post

2 REPLIES 2

L5 Sessionator

Hi @Bhargav_2784,

 

Per the docs (by the way, for your bookmarks, the current docs are https://paloaltonetworks.github.io/pan-os-ansible not https://ansible-pan.readthedocs.io) you only have to make a couple of changes:

  • nexthop should be the name of the VR which is the next hop, which per your code is probably not 'next-vr' but something else?
  • nexthop_type should not be 'none', it should be the string 'next-vr', per the docs (https://paloaltonetworks.github.io/pan-os-ansible/modules/panos_static_route_module.html)
  • virtual_router should be the VR into which you are placing this static route
  • interface does not need to be defined at all, comment it out or remove it

An example from your code:

 

  - name: Create route to aws tunnel-1
    panos_static_route:
          provider: '{{ provider }}'
          name: "Route {{ item.id }} to {{ vendor_name }}"
          destination: '{{ item.vpc_net }}'
          #interface: 'None'
          nexthop: '{{ your-next-vr }}'
          nexthop_type: 'next-vr'
          virtual_router: '{{ the-vr-requiring-the-route }}'

 

 

Hope this helps!

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

L1 Bithead

thanks @JimmyHolland  , that works...

  • 1 accepted solution
  • 1872 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!