.. Document meta :orphan: .. |antsibull-internal-nbsp| unicode:: 0xA0 :trim: .. role:: ansible-attribute-support-label .. role:: ansible-attribute-support-property .. role:: ansible-attribute-support-full .. role:: ansible-attribute-support-partial .. role:: ansible-attribute-support-none .. role:: ansible-attribute-support-na .. role:: ansible-option-type .. role:: ansible-option-elements .. role:: ansible-option-required .. role:: ansible-option-versionadded .. role:: ansible-option-aliases .. role:: ansible-option-choices .. role:: ansible-option-choices-default-mark .. role:: ansible-option-default-bold .. role:: ansible-option-configuration .. role:: ansible-option-returned-bold .. role:: ansible-option-sample-bold .. Anchors .. _ansible_collections.amnesh.soodar.soodar_static_routes_module: .. Anchors: short name for ansible.builtin .. Anchors: aliases .. Title amnesh.soodar.soodar_static_routes module -- Configure and manage static routes on Soodar devices. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. Collection note .. note:: This module is part of the `amnesh.soodar collection `_ (version 1.0.0). To install it, use: :code:`ansible-galaxy collection install https://soodar.ir/ansible/amnesh.soodar.tar.gz`. To use it in a playbook, specify: :code:`amnesh.soodar.soodar_static_routes`. .. version_added .. rst-class:: ansible-version-added New in amnesh.soodar 1.0 .. contents:: :local: :depth: 1 .. Deprecated Synopsis -------- .. Description - This module configures and manages the static routes on Soodar platforms. .. note:: This module has a corresponding :ref:`action plugin `. .. Aliases .. Requirements .. Options Parameters ---------- .. rst-class:: ansible-option-table .. list-table:: :width: 100% :widths: auto :header-rows: 1 * - Parameter - Comments * - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config: .. rst-class:: ansible-option-title **config** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` .. raw:: html
- .. raw:: html
A dictionary of static route options .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families: .. rst-class:: ansible-option-title **address_families** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` .. raw:: html
- .. raw:: html
Address family to use for the static routes .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/afi: .. rst-class:: ansible-option-title **afi** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` / :ansible-option-required:`required` .. raw:: html
- .. raw:: html
Top level address family indicator. .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry:`"ipv4"` - :ansible-option-choices-entry:`"ipv6"` .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/routes: .. rst-class:: ansible-option-title **routes** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` .. raw:: html
- .. raw:: html
Configuring static route .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/routes/dest: .. rst-class:: ansible-option-title **dest** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` / :ansible-option-required:`required` .. raw:: html
- .. raw:: html
Destination prefix with its subnet mask .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/routes/next_hops: .. rst-class:: ansible-option-title **next_hops** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` .. raw:: html
- .. raw:: html
next hop address or interface .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/routes/next_hops/distance_metric: .. rst-class:: ansible-option-title **distance_metric** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`integer` .. raw:: html
- .. raw:: html
Distance metric for this route .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/routes/next_hops/forward_router_address: .. rst-class:: ansible-option-title **forward_router_address** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Forwarding router's address .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/routes/next_hops/interface: .. rst-class:: ansible-option-title **interface** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Interface for directly connected static routes .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/address_families/routes/next_hops/tag: .. rst-class:: ansible-option-title **tag** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`integer` .. raw:: html
- .. raw:: html
Set tag for this route Refer to vendor documentation for valid values. .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-config/vrf: .. rst-class:: ansible-option-title **vrf** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
IP VPN Routing/Forwarding instance name. NOTE, In case of IPV4/IPV6 VRF routing table should pre-exist before configuring. NOTE, if the vrf information is not provided then the routes shall be configured under global vrf. .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-running_config: .. rst-class:: ansible-option-title **running_config** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
This option is used only with state \ :emphasis:`parsed`\ . The value of this option should be the output received from the Soodar device by executing the command \ :strong:`show running-config | include ip route|ipv6 route`\ . The state \ :emphasis:`parsed`\ reads the configuration from \ :literal:`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 \ :emphasis:`parsed`\ key within the result. .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__parameter-state: .. rst-class:: ansible-option-title **state** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
The state the configuration should be left in The states \ :emphasis:`rendered`\ , \ :emphasis:`gathered`\ and \ :emphasis:`parsed`\ does not perform any change on the device. The state \ :emphasis:`rendered`\ will transform the configuration in \ :literal:`config`\ option to platform specific CLI commands which will be returned in the \ :emphasis:`rendered`\ key within the result. For state \ :emphasis:`rendered`\ active connection to remote host is not required. The state \ :emphasis:`gathered`\ will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the \ :emphasis:`gathered`\ key within the result. The state \ :emphasis:`parsed`\ reads the configuration from \ :literal:`running\_config`\ option and transforms it into JSON format as per the resource module parameters and the value is returned in the \ :emphasis:`parsed`\ key within the result. The value of \ :literal:`running\_config`\ option should be the same format as the output of command \ :emphasis:`show running-config | include ip route|ipv6 route`\ executed on device. For state \ :emphasis:`parsed`\ active connection to remote host is not required. .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry-default:`"merged"` :ansible-option-choices-default-mark:`← (default)` - :ansible-option-choices-entry:`"replaced"` - :ansible-option-choices-entry:`"overridden"` - :ansible-option-choices-entry:`"deleted"` - :ansible-option-choices-entry:`"gathered"` - :ansible-option-choices-entry:`"rendered"` - :ansible-option-choices-entry:`"parsed"` .. raw:: html
.. Attributes .. Notes Notes ----- .. note:: - Tested against Soodar Version 21.04 .. Seealso .. Examples Examples -------- .. code-block:: yaml+jinja # Using Deleted # Example 1: # ---------- # To delete the exact static routes, with all the static routes explicitly mentioned in want # Before state: # ------------- # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 - name: Delete provided configuration from the device configuration amnesh.soodar.soodar_static_routes: config: - vrf: ansible_temp_vrf address_families: - afi: ipv4 routes: - dest: 192.0.2.0/24 next_hops: - forward_router_address: 192.0.2.1 tag: 50 - address_families: - afi: ipv4 routes: - dest: 198.51.100.0/24 next_hops: - forward_router_address: 198.51.101.1 distance_metric: 110 tag: 40 - forward_router_address: 198.51.101.2 distance_metric: 30 - forward_router_address: 198.51.101.3 - afi: ipv6 routes: - dest: 2001:DB8:0:3::/64 next_hops: - forward_router_address: 2001:DB8:0:3::2 tag: 105 state: deleted # Commands fired: # --------------- # no ip route 192.0.2.0/24 198.51.101.8 vrf ansible_temp_vrf tag 50 # no ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # no ip route 198.51.100.0/24 198.51.101.2 30 # no ip route 198.51.100.0/24 198.51.101.3 # no ipv6 route FD5D:12C9:2201:1::/64 FD5D:12C9:2202::2 tag 105 # After state: # ------------ # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # Example 2: # ---------- # To delete the destination specific static routes # Before state: # ------------- # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 - name: Delete provided configuration from the device configuration amnesh.soodar.soodar_static_routes: config: - address_families: - afi: ipv4 routes: - dest: 198.51.100.0/24 state: deleted # Commands fired: # --------------- # no ip route 198.51.100.0/24 198.51.101.3 # no ip route 198.51.100.0/24 198.51.101.2 30 # no ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # After state: # ------------ # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 # Example 3: # ---------- # To delete the vrf specific static routes # Before state: # ------------- # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 - name: Delete provided configuration from the device configuration amnesh.soodar.soodar_static_routes: config: - vrf: ansible_temp_vrf state: deleted # Commands fired: # --------------- # no ip route 192.0.2.0/24 192.0.2.1 vrf ansible_temp_vrf tag 50 # After state: # ------------ # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # ip route 198.51.100.0/24 198.51.101.3 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 # Using Deleted without any config passed #"(NOTE: This will delete all of configured resource module attributes from each configured interface)" # Before state: # ------------- # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 - name: Delete ALL configured Soodar static routes amnesh.soodar.soodar_static_routes: state: deleted # Commands fired: # --------------- # no ip route 192.0.2.0/24 192.0.2.1 vrf ansible_temp_vrf tag 50 # no ip route 198.51.100.0/24 198.51.101.3 # no ip route 198.51.100.0/24 198.51.101.2 30 # no ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # no ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 # After state: # ------------- # # soodar#show running-config | section ^ip route|ipv6 route|^vrf # # Using merged # Before state: # ------------- # # soodar# show running-config | section ^ip route|ipv6 route|^vrf - name: Merge provided configuration with device configuration amnesh.soodar.soodar_static_routes: config: - vrf: blue address_families: - afi: ipv4 routes: - dest: 192.0.2.0/24 next_hops: - forward_router_address: 192.0.2.1 tag: 50 - address_families: - afi: ipv4 routes: - dest: 198.51.100.0/24 next_hops: - forward_router_address: 198.51.101.1 distance_metric: 110 tag: 40 - forward_router_address: 198.51.101.2 distance_metric: 30 - forward_router_address: 198.51.101.3 - afi: ipv6 routes: - dest: 2001:db8:0:3::/64 next_hops: - forward_router_address: 2001:db8:0:3::2 tag: 105 state: merged # Commands fired: # --------------- # ip route 192.0.2.0 /24 10.0.0.8 vrf blue track 150 tag 50 # ip route 198.51.100.0 /24 198.51.101.1 110 tag 40 # ip route 198.51.100.0 /24 198.51.101.2 30 # ip route 198.51.100.0 /24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 # After state: # ------------ # # soodar# show running-config | section ^ip route|ipv6 route|^vrf # vrf blue # ip route 192.0.2.0 /24 192.0.2.1 tag 50 # ip route 198.51.100.0 /24 198.51.101.3 # ip route 198.51.100.0 /24 198.51.101.2 30 # ip route 198.51.100.0 /24 198.51.101.1 110 tag 40 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 # Using replaced # Before state: # ------------- # # soodar# show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 - name: Replace provided configuration with device configuration amnesh.soodar.soodar_static_routes: config: - address_families: - afi: ipv4 routes: - dest: 198.51.100.0/24 next_hops: - forward_router_address: 198.51.101.1 distance_metric: 175 tag: 70 state: replaced # Commands fired: # --------------- # no ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # no ip route 198.51.100.0/24 198.51.101.2 30 # no ip route 198.51.100.0/24 198.51.101.3 # ip route 198.51.100.0/24 198.51.101.1 175 tag 70 # After state: # ------------ # # soodar# show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 175 tag 70 # ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 # Using overridden # Before state: # ------------- # # soodar# show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 - name: Override provided configuration with device configuration amnesh.soodar.soodar_static_routes: config: - vrf: blue address_families: - afi: ipv4 routes: - dest: 192.0.2.0/24 next_hops: - forward_router_address: 192.0.2.1 tag: 50 state: overridden # Commands fired: # --------------- # no ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # no ip route 198.51.100.0/24 198.51.101.2 30 # no ip route 198.51.100.0/24 198.51.101.3 # no ip route 192.0.2.0/24 198.51.101.8 vrf ansible_temp_vrf tag 50 # no ipv6 route FD5D:12C9:2201:1::/64 FD5D:12C9:2202::2 tag 105 # ip route 192.0.2.0/24 198.51.101.4 vrf blue tag 50 # After state: # ------------ # # soodar# show running-config | section ^ip route|ipv6 route|^vrf # vrf blue # ip route 192.0.2.0/24 192.0.2.1 tag 50 # Using gathered # Before state: # ------------- # # soodar# show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 - name: Gather listed static routes with provided configurations amnesh.soodar.soodar_static_routes: config: state: gathered # Module Execution Result: # ------------------------ # # "gathered": [ # { # "address_families": [ # { # "afi": "ipv4", # "routes": [ # { # "dest": "192.0.2.0/24", # "next_hops": [ # { # "forward_router_address": "192.0.2.1", # "tag": 50, # } # ] # } # ] # } # ], # "vrf": "ansible_temp_vrf" # }, # { # "address_families": [ # { # "afi": "ipv6", # "routes": [ # { # "dest": "2001:DB8:0:3::/64", # "next_hops": [ # { # "forward_router_address": "2001:DB8:0:3::2", # "tag": 105 # } # ] # } # ] # }, # { # "afi": "ipv4", # "routes": [ # { # "dest": "198.51.100.0/24", # "next_hops": [ # { # "distance_metric": 110, # "forward_router_address": "198.51.101.1", # "tag": 40 # }, # { # "distance_metric": 30, # "forward_router_address": "198.51.101.2", # }, # { # "forward_router_address": "198.51.101.3", # } # ] # } # ] # } # ] # } # ] # After state: # ------------ # # soodar# show running-config | section ^ip route|ipv6 route|^vrf # vrf ansible_temp_vrf # ip route 192.0.2.0/24 192.0.2.1 tag 50 # ip route 198.51.100.0/24 198.51.101.1 110 tag 40 # ip route 198.51.100.0/24 198.51.101.2 30 # ip route 198.51.100.0/24 198.51.101.3 # ipv6 route 2001:db8:0:3::/64 2001:db8:0:3::2 tag 105 # Using rendered - name: Render the commands for provided configuration amnesh.soodar.soodar_static_routes: config: - vrf: ansible_temp_vrf address_families: - afi: ipv4 routes: - dest: 192.0.2.0/24 next_hops: - forward_router_address: 192.0.2.1 tag: 50 - address_families: - afi: ipv4 routes: - dest: 198.51.100.0/24 next_hops: - forward_router_address: 198.51.101.1 distance_metric: 110 tag: 40 - forward_router_address: 198.51.101.2 distance_metric: 30 - forward_router_address: 198.51.101.3 - afi: ipv6 routes: - dest: 2001:DB8:0:3::/64 next_hops: - forward_router_address: 2001:DB8:0:3::2 tag: 105 state: rendered # Module Execution Result: # ------------------------ # # "rendered": [ # "ip route 192.0.2.0/24 192.0.2.1 vrf ansible_temp_vrf tag 50", # "ip route 198.51.100.0/24 198.51.101.1 110 tag 40", # "ip route 198.51.100.0/24 198.51.101.2 30", # "ip route 198.51.100.0/24 198.51.101.3", # "ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105" # ] .. Facts .. Return values Return Values ------------- Common return values are documented :ref:`here `, the following are the fields unique to this module: .. rst-class:: ansible-option-table .. list-table:: :width: 100% :widths: auto :header-rows: 1 * - Key - Description * - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__return-after: .. rst-class:: ansible-option-title **after** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`list` / :ansible-option-elements:`elements=string` .. raw:: html
- .. raw:: html
The configuration as structured data after module completion. .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` when changed .. rst-class:: ansible-option-line .. rst-class:: ansible-option-sample :ansible-option-sample-bold:`Sample:` :ansible-rv-sample-value:`["The configuration returned will always be in the same format of the parameters above."]` .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__return-before: .. rst-class:: ansible-option-title **before** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`list` / :ansible-option-elements:`elements=string` .. raw:: html
- .. raw:: html
The configuration as structured data prior to module invocation. .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` always .. rst-class:: ansible-option-line .. rst-class:: ansible-option-sample :ansible-option-sample-bold:`Sample:` :ansible-rv-sample-value:`["The configuration returned will always be in the same format of the parameters above."]` .. raw:: html
* - .. raw:: html
.. _ansible_collections.amnesh.soodar.soodar_static_routes_module__return-commands: .. rst-class:: ansible-option-title **commands** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`list` / :ansible-option-elements:`elements=string` .. raw:: html
- .. raw:: html
The set of commands pushed to the remote device .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` always .. rst-class:: ansible-option-line .. rst-class:: ansible-option-sample :ansible-option-sample-bold:`Sample:` :ansible-rv-sample-value:`["ip route 172.31.10.0 255.255.255.0 10.10.10.2 vrf test"]` .. raw:: html
.. Status (Presently only deprecated) .. Authors Authors ~~~~~~~ - Mahdi Varasteh (@m-varasteh) .. Extra links Collection links ~~~~~~~~~~~~~~~~ .. raw:: html .. Parsing errors