junipernetworks.junos.junos_static_routes module – Static routes resource module
Note
This module is part of the junipernetworks.junos collection (version 3.1.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install junipernetworks.junos
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: junipernetworks.junos.junos_static_routes
.
New in junipernetworks.junos 1.0.0
Synopsis
This module provides declarative management of static routes on Juniper JUNOS devices
Note
This module has a corresponding action plugin.
Requirements
The below requirements are needed on the host that executes this module.
ncclient (>=v0.6.4)
xmltodict (>=0.12)
Parameters
Parameter |
Comments |
---|---|
A dictionary of static routes options |
|
Address family to use for the static routes |
|
afi to use for the static routes Choices:
|
|
Static route configuration |
|
Static route destination including prefix |
|
Metric value for the static route |
|
Next hop to destination |
|
List of next hops |
|
Virtual Routing and Forwarding (VRF) name |
|
This option is used only with state parsed. The value of this option should be the output received from the Junos device by executing the command show routing-options. The state parsed reads the configuration from |
|
The state the configuration should be left in Choices:
|
Notes
Note
This module requires the netconf system service be enabled on the device being managed.
This module works with connection
netconf
. See the Junos OS Platform Options.Tested against JunOS v18.4R1
Examples
# Using deleted
# Before state
# ------------
#
# admin# show routing-options
# static {
# route 192.168.47.0/24 next-hop 172.16.1.2;
# route 192.168.16.0/24 next-hop 172.16.1.2;
# route 10.200.16.75/24 next-hop 10.200.16.2;
# }
- name: Delete provided configuration (default operation is merge)
junipernetworks.junos.junos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 10.200.16.75/24
next_hop:
- forward_router_address: 10.200.16.2
state: deleted
# After state:
# ------------
#
# admin# show routing-options
# static {
# route 192.168.47.0/24 next-hop 172.16.1.2;
# route 192.168.16.0/24 next-hop 172.16.1.2;
# }
# Using merged
# Before state
# ------------
#
# admin# show routing-options
# static {
# route 192.168.47.0/24 next-hop 172.16.1.2;
# route 192.168.16.0/24 next-hop 172.16.1.2;
# }
- name: Merge provided configuration with device configuration (default operation
is merge)
junipernetworks.junos.junos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 10.200.16.75/24
next_hop:
- forward_router_address: 10.200.16.2
state: merged
# After state:
# ------------
#
# admin# show routing-options
# static {
# route 192.168.47.0/24 next-hop 172.16.1.2;
# route 192.168.16.0/24 next-hop 172.16.1.2;
# route 10.200.16.75/24 next-hop 10.200.16.2;
# }
# Using overridden
# Before state
# ------------
#
# admin# show routing-options
# static {
# route 192.168.47.0/24 next-hop 172.16.1.2;
# route 192.168.16.0/24 next-hop 172.16.0.1;
# }
- name: Override provided configuration with device configuration (default operation
is merge)
junipernetworks.junos.junos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 10.200.16.75/24
next_hop:
- forward_router_address: 10.200.16.2
state: overridden
# After state:
# ------------
#
# admin# show routing-options
# static {
# route 10.200.16.75/24 next-hop 10.200.16.2;
# }
# Using replaced
# Before state
# ------------
#
# admin# show routing-options
# static {
# route 192.168.47.0/24 next-hop 172.16.1.2;
# route 192.168.16.0/24 next-hop 172.16.1.2;
# }
- name: Replace provided configuration with device configuration (default operation
is merge)
junipernetworks.junos.junos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 192.168.47.0/24
next_hop:
- forward_router_address: 10.200.16.2
state: replaced
# After state:
# ------------
#
# admin# show routing-options
# static {
# route 192.168.47.0/24 next-hop 10.200.16.2;
# route 192.168.16.0/24 next-hop 172.16.1.2;
# }
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration model invocation. Returned: when changed Sample: |
|
The configuration prior to the model invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device. Returned: always Sample: |