route – Manage routes on IBM AIX systems.
Synopsis
This module allows adding, deleting, flushing, or listing routes in IBM AIX systems.
Supports advanced options such as `-f`, `-n`, `-C`, `-v`, and WPAR-specific routing.
Requirements
The below requirements are needed on the host that executes this module.
AIX >= 7.1 TL3
Python >= 3.6
Root user is required.
Parameters
- action (True, str, None)
Specifies the action to perform.
add
Adds a route.
flush
Removes all routes.
delete
Deletes a specific route.
change
Changes aspects of a route (such as its gateway).
get
Lookup and display the route for a destination.
set
Set the policy and weight attributes of a route.- destination (False, str, None)
The destination network or host IP address.
- gateway (False, str, None)
The gateway IP address for routing.
- netmask (False, str, None)
Specifies the network mask for the destination.
- prefixlen (False, int, None)
Specifies the prefix length of the destination.
- arguments (False, dict, None)
Additional route-specific arguments like `-weight`, `-policy`, etc., to be appended after the gateway.
- flush (False, bool, None)
Corresponds to the `-f` flag. Purges all entries in the routing table that are not associated with network interfaces.
- numeric (False, bool, None)
Corresponds to the `-n` flag. Displays host and network names numerically rather than symbolically.
- ioctl_preference (False, bool, None)
Corresponds to the `-C` flag. Specifies preference for ioctl calls over routing messages for adding and removing routes.
- verbose (False, bool, None)
Corresponds to the `-v` flag. Prints additional details.
- flags (False, str, host)
List of additional flags for the route command such as `net` or`host`.
- family (False, str, None)
Specifies the address family, such as `-inet` or `-inet6`.
Notes
Note
Refer to IBM documentation for more details on route commands at https://www.ibm.com/docs/en/aix/7.3?topic=r-route-command.
Examples
- name: Add a route to 192.168.1.0/24 via 192.168.0.1
aix_route_command:
action: add
destination: 192.168.1.0
netmask: 255.255.255.0
gateway: 192.168.0.1
- name: Delete a route to 192.168.1.0/24
aix_route_command:
action: delete
destination: 192.168.1.0
netmask: 255.255.255.0
- name: Flush all routes
aix_route_command:
action: flush
flush: true
- name: Add a route with verbose mode
aix_route_command:
action: add
destination: 10.0.0.0
prefixlen: 24
gateway: 192.168.1.1
verbose: true
- name: Add a route with weight and policy
aix_route_command:
action: add
destination: 192.158.2.2
gateway: 192.158.2.5
arguments:
- -weight
- "5"
- -policy
- "4"
- name: Add a route for a specific destination_ip
aix_route_command:
action: add
destination: 192.168.1.0
netmask: 255.255.255.0
gateway: 192.168.0.1
Return Values
- msg (always, str, Route added successfully.)
Execution message.
- rc (always, int, )
Return code of the route command.
- stdout (when applicable, str, )
Standard output of the route command.
- stderr (when applicable, str, )
Standard error of the route command.
- cmd (always, str, )
The exact command run by the module.