New in version 2.4.
Parameter | Choices/Defaults | Comments |
---|---|---|
aftype required |
| Destination ip address family type of static route. |
description | Name of the route. Used with the name parameter on the CLI. | |
destvrf | VPN instance of next hop ip address. | |
mask required | Destination ip mask of static route. | |
next_hop | Next hop address of static route. | |
nhp_interface | Next hop interface full name of static route. | |
pref | Preference or administrative difference of route (range 1-255). | |
prefix required | Destination ip address of static route. | |
state |
| Specify desired state of the resource. |
tag | Route tag value (numeric). | |
vrf | VPN instance of destination ip address. |
Note
- name: static route module test hosts: cloudengine connection: local gather_facts: no vars: cli: host: "{{ inventory_hostname }}" port: "{{ ansible_ssh_port }}" username: "{{ username }}" password: "{{ password }}" transport: cli tasks: - name: Config a ipv4 static route, next hop is an address and that it has the proper description ce_static_route: prefix: 2.1.1.2 mask: 24 next_hop: 3.1.1.2 description: 'Configured by Ansible' aftype: v4 provider: "{{ cli }}" - name: Config a ipv4 static route ,next hop is an interface and that it has the proper description ce_static_route: prefix: 2.1.1.2 mask: 24 next_hop: 10GE1/0/1 description: 'Configured by Ansible' aftype: v4 provider: "{{ cli }}" - name: Config a ipv6 static route, next hop is an address and that it has the proper description ce_static_route: prefix: fc00:0:0:2001::1 mask: 64 next_hop: fc00:0:0:2004::1 description: 'Configured by Ansible' aftype: v6 provider: "{{ cli }}" - name: Config a ipv4 static route, next hop is an interface and that it has the proper description ce_static_route: prefix: fc00:0:0:2001::1 mask: 64 next_hop: 10GE1/0/1 description: 'Configured by Ansible' aftype: v6 provider: "{{ cli }}" - name: Config a VRF and set ipv4 static route, next hop is an address and that it has the proper description ce_static_route: vrf: vpna prefix: 2.1.1.2 mask: 24 next_hop: 3.1.1.2 description: 'Configured by Ansible' aftype: v4 provider: "{{ cli }}"
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
changed boolean | always | check to see if a change was made on the device Sample: True |
end_state dict | always | k/v pairs of switchport after module execution Sample: {'prefix': '192.168.20.0', 'next_hop': '3.3.3.3', 'description': 'testing', 'tag': 'null', 'pref': '100', 'mask': '24'} |
existing dict | always | k/v pairs of existing switchport |
proposed dict | always | k/v pairs of parameters passed into module Sample: {'prefix': '192.168.20.642', 'next_hop': '3.3.3.3', 'description': 'testing', 'pref': '100', 'mask': '24', 'vrf': '_public_'} |
updates list | always | command list sent to the device Sample: ['ip route-static 192.168.20.0 255.255.255.0 3.3.3.3 preference 100 description testing'] |
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/ce_static_route_module.html