graphiant.naas.graphiant_prefix_port_list module – Manage Graphiant prefix and port lists (edge.trafficPolicy.networkLists, edge.trafficPolicy.portLists)
Note
This module is part of the graphiant.naas collection (version 26.5.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_prefix_port_list.
New in graphiant.naas 26.5.0
Synopsis
Create or delete prefix and port lists under edge traffic policy (edge.trafficPolicy.networkLists, edge.trafficPolicy.portLists).
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.5.0
Parameters
Parameter |
Comments |
|---|---|
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 |
|
Enable detailed logging. Choices:
|
|
Graphiant portal host URL for API connectivity. Example: “https://api.graphiant.com” |
|
Specific operation to perform.
Choices:
|
|
Graphiant portal password for authentication. Required for password-based login when no valid bearer token is available from |
|
Path to the prefix and port list YAML file. Can be an absolute path or relative to the configured config_path. Expected top-level key is |
|
Desired state for prefix and port lists.
Choices:
|
|
Graphiant portal username for authentication. Required for password-based login when no valid bearer token is available from |
Attributes
Attribute |
Support |
Description |
|---|---|---|
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. |
|
Support: full When the playbook runs with |
Supports Ansible’s |
Notes
Note
Prefix and Port List Operations:
- Create_prefix_port_lists: Create prefix and port lists listed in the config.
- Delete_prefix_port_lists: Delete prefix and port lists listed in the config.
- Create_prefix_lists: Create prefix lists listed in the config.
- Delete_prefix_lists: Delete prefix lists listed in the config.
- Create_port_lists: Create port lists listed in the config.
- Delete_port_lists: Delete port lists 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:
networkLists,portLists).Create idempotency: compares intended prefix and port lists to existing device state; skips push when already matched (
changed=false).On
create_*operations, each list entry may usestate: absentto remove that name only (sendslist: null) while other entries in the same file are created or updated. Default isstate: present.Delete deletes only the prefix and port lists listed in the YAML.
Delete payload uses
networkLists: nullandportLists: null; this module preserves nulls in the final payload pushed to the API.With
ansible-playbook --check, writes are skipped butchangedreflects whether an apply would update at least one device. Use--diffto previewdetails.diff_planand Ansiblediff.
Examples
- name: Configure prefix and port lists
graphiant.naas.graphiant_prefix_port_list:
operation: create_prefix_port_lists
prefix_port_list_config_file: "sample_prefix_and_port_list.yaml"
detailed_logs: true
state: present
register: create_prefix_port_lists_result
no_log: true
- name: Display result message (includes detailed logs)
ansible.builtin.debug:
msg: "{{ prefix_port_list_result.msg }}"
- name: Deconfigure prefix and port lists (deletes only prefixes and port lists listed in YAML)
graphiant.naas.graphiant_prefix_port_list:
operation: delete_prefix_port_lists
prefix_port_list_config_file: "sample_prefix_and_port_list.yaml"
detailed_logs: true
state: absent
register: delete_prefix_port_lists_result
no_log: true
- name: Create prefix lists
graphiant.naas.graphiant_prefix_port_list:
operation: create_prefix_lists
prefix_port_list_config_file: "sample_prefix_and_port_list.yaml"
detailed_logs: true
state: present
register: create_prefix_lists_result
no_log: true
- name: Display create prefix lists result message (includes detailed logs)
ansible.builtin.debug:
msg: "{{ create_prefix_lists_result.msg }}"
no_log: true
- name: Delete prefix lists
graphiant.naas.graphiant_prefix_port_list:
operation: delete_prefix_lists
prefix_port_list_config_file: "sample_prefix_and_port_list.yaml"
detailed_logs: true
state: absent
register: delete_prefix_lists_result
no_log: true
- name: Display delete prefix lists result message (includes detailed logs)
ansible.builtin.debug:
msg: "{{ delete_prefix_lists_result.msg }}"
no_log: true
- name: Create port lists
graphiant.naas.graphiant_prefix_port_list:
operation: create_port_lists
prefix_port_list_config_file: "sample_prefix_and_port_list.yaml"
detailed_logs: true
state: present
register: create_port_lists_result
no_log: true
- name: Display create port lists result message (includes detailed logs)
ansible.builtin.debug:
msg: "{{ create_port_lists_result.msg }}"
no_log: true
- name: Delete port lists
graphiant.naas.graphiant_prefix_port_list:
operation: delete_port_lists
prefix_port_list_config_file: "sample_prefix_and_port_list.yaml"
detailed_logs: true
state: absent
register: delete_port_lists_result
no_log: true
- name: Display delete port lists result message (includes detailed logs)
ansible.builtin.debug:
msg: "{{ delete_port_lists_result.msg }}"
no_log: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Whether the operation made changes.
In check mode ( Returned: always Sample: |
|
Device names where configuration was pushed (when changed=true). Returned: when supported Sample: |
|
Raw manager result details (includes Returned: when supported |
|
Ansible diff output when the playbook runs with Returned: when diff mode is enabled and |
|
Result message from the operation, including detailed logs when Returned: always Sample: |
|
The operation performed. Returned: always Sample: |
|
The prefix and port list config file used for the operation. Returned: always Sample: |
|
Device names that were skipped because desired state already matched. Returned: when supported Sample: |