Note
This plugin is part of the junipernetworks.junos collection.
To install it use: ansible-galaxy collection install junipernetworks.junos
.
To use it in a playbook, specify: junipernetworks.junos.junos_static_routes
.
New in version 1.0.0: of junipernetworks.junos
Note
This module has a corresponding action plugin.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments | ||||
---|---|---|---|---|---|---|
config list / elements=dictionary | A dictionary of static routes options | |||||
address_families list / elements=dictionary | Address family to use for the static routes | |||||
afi string / required |
| afi to use for the static routes | ||||
routes list / elements=dictionary | Static route configuration | |||||
dest string | Static route destination including prefix | |||||
metric integer | Metric value for the static route | |||||
next_hop list / elements=dictionary | Next hop to destination | |||||
forward_router_address string | List of next hops | |||||
vrf string | Virtual Routing and Forwarding (VRF) name | |||||
running_config string | 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 running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result | |||||
state string |
| The state the configuration should be left in |
Note
netconf
. See the Junos OS Platform Options.# 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; # }
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
after string | when changed | The resulting configuration model invocation. Sample: The configuration returned will always be in the same format of the parameters above. |
before string | always | The configuration prior to the model invocation. Sample: The configuration returned will always be in the same format of the parameters above. |
commands list / elements=string | always | The set of commands pushed to the remote device. Sample: ['command 1', 'command 2', 'command 3'] |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/junipernetworks/junos/junos_static_routes_module.html