junos_static_route - Manage static IP routes on Juniper JUNOS network devices

New in version 2.4.

Synopsis

  • This module provides declarative management of static IP routes on Juniper JUNOS network devices.

Requirements (on host that executes module)

  • ncclient (>=v0.5.2)

Options

parameter required default choices comments
active
no True
  • True
  • False
Specifies whether or not the configuration is active or deactivated
address
yes
Network address with prefix of the static route.
aliases: prefix
aggregate
no
List of static route definitions
next_hop
yes
Next hop IP of the static route.
preference
no
Global admin preference of the static route.
aliases: admin_distance
qualified_next_hop
no
Qualified next hop IP of the static route. Qualified next hops allow to associate preference with a particular next-hop address.
qualified_preference
no
Assign preference for qualified next hop.
state
no present
  • present
  • absent
State of the static route configuration.

Examples

- name: configure static route
  junos_static_route:
    address: 192.168.2.0/24
    next_hop: 10.0.0.1
    preference: 10
    qualified_next_hop: 10.0.0.2
    qualified_preference: 3
    state: present

- name: delete static route
  junos_static_route:
    address: 192.168.2.0/24
    state: absent

- name: deactivate static route configuration
  junos_static_route:
    address: 192.168.2.0/24
    next_hop: 10.0.0.1
    preference: 10
    qualified_next_hop: 10.0.0.2
    qualified_preference: 3
    state: present
    active: False

- name: activate static route configuration
  junos_static_route:
    address: 192.168.2.0/24
    next_hop: 10.0.0.1
    preference: 10
    qualified_next_hop: 10.0.0.2
    qualified_preference: 3
    state: present
    active: True

- name: Configure static route using aggregate
  junos_static_route:
    aggregate:
    - { address: 4.4.4.0/24, next_hop: 3.3.3.3, qualified_next_hop: 5.5.5.5, qualified_preference: 30 }
    - { address: 5.5.5.0/24, next_hop: 6.6.6.6, qualified_next_hop: 7.7.7.7, qualified_preference: 12 }
    preference: 10

- name: Delete static route using aggregate
  junos_static_route:
    aggregate:
    - address: 4.4.4.0/24
    - address: 5.5.5.0/24
    state: absent

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
diff.prepared
Configuration difference before and after applying change.
when configuration is changed and diff option is enabled. string [edit routing-options static] route 2.2.2.0/24 { ... } + route 4.4.4.0/24 { next-hop 3.3.3.3; qualified-next-hop 5.5.5.5 { + preference 30; } + preference 10; + }

Notes

Note

  • This module requires the netconf system service be enabled on the remote device being managed.
  • Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/junos_static_route_module.html