graphiant.naas.graphiant_static_routes module – Manage Graphiant static routes (edge.segments.*.staticRoutes)
Note
This module is part of the graphiant.naas collection (version 26.4.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 graphiant.naas. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: graphiant.naas.graphiant_static_routes.
New in graphiant.naas 26.2.0
Synopsis
- Configure or delete static routes under edge segments (edge.segments.<segment>.staticRoutes).
- Reads a structured YAML config file and builds the raw device-config payload in Python.
- All operations are idempotent and safe to run multiple times.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 3.7
- graphiant-sdk >= 26.4.0
Parameters
Parameter | Comments |
|---|---|
access_token string | Bearer token for API authentication (for example, from If not passed as a module argument, the collection reads When a bearer token is present (module argument or environment), it takes precedence over If no valid token is available, the module authenticates with |
detailed_logs boolean | Enable detailed logging. Choices:
|
host aliases: base_url string / required | Graphiant portal host URL for API connectivity. Example: “https://api.graphiant.com” |
operation string | Specific operation to perform.
Choices:
|
password string | Graphiant portal password for authentication. Required for password-based login when no valid bearer token is available from |
state string | Desired state for routes.
Choices:
|
static_routes_config_file aliases: static_route_config_file string / required | Path to the static routes YAML file. Can be an absolute path or relative to the configured config_path. Expected top-level key is |
username string | Graphiant portal username for authentication. Required for password-based login when no valid bearer token is available from |
Attributes
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full In check mode, no configuration is pushed to devices, but the module still reads current device state to determine whether changes would be made. Payloads that would be pushed are logged with a | Supports check mode. |
Notes
Note
- Static Routes Operations:
- - Configure: Create/update static routes listed in the config.
- - Deconfigure: Delete static routes listed in the config.
- Configuration files support Jinja2 templating syntax for dynamic configuration generation.
- The module automatically resolves device names to IDs.
- YAML schema uses camelCase keys (for example:
staticRoutes,lanSegment,destinationPrefix,nextHops). - Configure idempotency: compares intended routes to existing device state per segment + prefix; skips push when already matched (
changed=false). - Deconfigure deletes only the prefixes listed in the YAML (per segment).
- Deconfigure payload uses
route: nullper prefix; this module preserves nulls in the final payload pushed to the API.
See Also
See also
- graphiant.naas.graphiant_global_config
-
Configure LAN segments before applying routes (if needed)
- graphiant.naas.graphiant_interfaces
-
Configure interfaces before applying routes (if needed)
- graphiant.naas.graphiant_device_config
-
Alternative method for pushing full device config payloads
Examples
- name: Configure static routes
graphiant.naas.graphiant_static_routes:
operation: configure
static_routes_config_file: "sample_static_route.yaml"
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
detailed_logs: true
register: static_routes_result
no_log: true
- name: Display result message (includes detailed logs)
ansible.builtin.debug:
msg: "{{ static_routes_result.msg }}"
- name: Deconfigure static routes (deletes only prefixes listed in YAML)
graphiant.naas.graphiant_static_routes:
operation: deconfigure
static_routes_config_file: "sample_static_route.yaml"
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
detailed_logs: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
changed boolean | Whether the operation made changes.
In check mode ( Returned: always Sample: |
configured_devices list / elements=string | Device names where configuration was pushed (when changed=true). Returned: when supported Sample: |
details dictionary | Raw manager result details (includes changed/configured_devices/skipped_devices). Returned: when supported |
msg string | Result message from the operation, including detailed logs when Returned: always Sample: |
operation string | The operation performed. Returned: always Sample: |
skipped_devices list / elements=string | Device names that were skipped because desired state already matched. Returned: when supported Sample: |
static_routes_config_file string | The static routes config file used for the operation. Returned: always Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/graphiant/naas/graphiant_static_routes_module.html