Spec-Zone.ru › Ansible

graphiant.naas.graphiant_lag_interfaces module – Manage Graphiant LAG (Link Aggregation Group) configuration

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_lag_interfaces.

New in graphiant.naas 26.1.0

  • Synopsis
  • Requirements
  • Parameters
  • Attributes
  • Notes
  • See Also
  • Examples
  • Return Values

Synopsis

  • This module provides comprehensive LAG management for Graphiant Edge and Gateway devices.
  • Supports configuring and deconfiguring LAGs, adding/removing LAG members, updating LACP settings, and managing LAG subinterfaces (VLANs).
  • All operations use Jinja2 templates for consistent configuration deployment.
  • Configuration files support Jinja2 templating for dynamic generation.
  • All operations are idempotent - safe to run multiple times without causing errors or unintended changes.

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 graphiant login, which opens a browser for sign-in (SSO or non-SSO) and retrieves the token).

If not passed as a module argument, the collection reads GRAPHIANT_ACCESS_TOKEN (set after graphiant login when you source ~/.graphiant/env.sh).

When a bearer token is present (module argument or environment), it takes precedence over username and password.

If no valid token is available, the module authenticates with username and password when both are supplied.

detailed_logs

boolean

Enable detailed logging output for troubleshooting and monitoring.

When enabled, provides comprehensive logs of all LAG operations.

Logs are captured and included in the result_msg for display using ansible.builtin.debug module.

Choices:

  • false ← (default)
  • true

host

aliases: base_url

string / required

Graphiant portal host URL for API connectivity.

Example: “https://api.graphiant.com”

lag_config_file

string / required

Path to the LAG configuration YAML file.

Required for all operations.

Can be an absolute path or relative path. Relative paths are resolved using the configured config_path.

Configuration files support Jinja2 templating syntax for dynamic generation.

File must contain LAG definitions with device names, LAG name/alias, segment, mtu, ipv4, ipv6, lacpMode, lacpTimer, member interfaces, and optional subinterfaces.

operation

string

The specific LAG operation to perform.

configure: Configure LAG for devices in the config file.

“deconfigure: Delete ALL subinterfaces (if present) and then delete the main LAG interface. Complete cleanup operation.”

add_lag_members: Add member interfaces to an existing LAG.

remove_lag_members: Remove member interfaces from an existing LAG.

update_lacp_configs: Update LACP mode/timer.

delete_lag_subinterfaces: Delete VLAN subinterfaces under the LAG.

Note: To add/configure LAG subinterfaces, use configure operation with subinterfaces in the config file.

Choices:

  • "configure"
  • "deconfigure"
  • "add_lag_members"
  • "remove_lag_members"
  • "update_lacp_configs"
  • "delete_lag_subinterfaces"

password

string

Graphiant portal password for authentication.

Required for password-based login when no valid bearer token is available from access_token or GRAPHIANT_ACCESS_TOKEN.

state

string

The desired state of the LAG configuration.

present: Maps to configure when operation is not specified.

absent: Maps to deconfigure when operation is not specified.

Choices:

  • "present" ← (default)
  • "absent"

username

string

Graphiant portal username for authentication.

Required for password-based login when no valid bearer token is available from access_token or GRAPHIANT_ACCESS_TOKEN.

Attributes

Attribute

Support

Description

check_mode

Support: full

When run with --check, the module logs the exact payloads that would be pushed with a [check_mode] prefix so you can see what configuration would be applied. The module does not perform state comparison, so changed may be True even when the configuration is already applied.

Supports check mode. In check mode, no configuration is pushed to the devices but payloads that would be pushed are logged with [check_mode].

Notes

Note

  • Check mode (--check): No config is pushed; payloads that would be pushed are logged with [check_mode].
  • LAG Operations:
  • - configure: Configure LAG on physical interfaces (and optionally subinterfaces). Idempotent - creates new LAGs or updates existing ones.
  • - deconfigure: Delete ALL subinterfaces (if present) and then delete the main LAG interface. This is a complete cleanup operation that removes everything. Idempotent - skips non-existent LAGs and subinterfaces.
  • - add_lag_members: Add member interfaces to an existing LAG. Idempotent - skips members already added.
  • - remove_lag_members: Remove member interfaces from an existing LAG. Idempotent - skips members already removed.
  • - update_lacp_configs: Update LACP mode/timer. Idempotent - skips if config already matches desired state.
  • - delete_lag_subinterfaces: Delete specified VLAN subinterfaces under the LAG. Only deletes subinterfaces listed in the config file. Idempotent - skips non-existent LAGs and subinterfaces.
  • Configuration files support Jinja2 templating syntax for dynamic configuration generation.
  • The module automatically resolves device names to IDs.
  • Idempotency Details:
  • The module queries existing LAG state before making changes. For configure operations, duplicate alias assignments are automatically handled by removing the alias from the payload when it matches the existing alias. For member operations, existing members are checked and only necessary changes are applied. For LACP updates, current mode/timer are compared before pushing configuration. For deconfigure, all existing subinterfaces are automatically detected and deleted before removing the main LAG. For delete_lag_subinterfaces, only specified subinterfaces are deleted. For deconfigure, all existing subinterfaces are automatically detected and deleted before removing the main LAG. For delete_lag_subinterfaces, only specified subinterfaces are deleted.
  • Member interfaces must exist on the device; interface names in the config are resolved to interface IDs via device info.

See Also

See also

graphiant.naas.graphiant_interfaces

Manage LAN/WAN interface and circuit configuration

Examples

- name: Configure LAG
  graphiant.naas.graphiant_lag_interfaces:
    operation: configure
    lag_config_file: "sample_lag_interface_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"
    detailed_logs: true
  register: lag_result

- name: Add LAG members
  graphiant.naas.graphiant_lag_interfaces:
    operation: add_lag_members
    lag_config_file: "sample_lag_interface_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Remove LAG members
  graphiant.naas.graphiant_lag_interfaces:
    operation: remove_lag_members
    lag_config_file: "sample_lag_interface_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Update LACP settings
  graphiant.naas.graphiant_lag_interfaces:
    operation: update_lacp_configs
    lag_config_file: "sample_lag_interface_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Configure LAG subinterfaces (use configure operation with subinterfaces in config)
  graphiant.naas.graphiant_lag_interfaces:
    operation: configure
    lag_config_file: "sample_lag_interface_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Delete LAG subinterfaces
  graphiant.naas.graphiant_lag_interfaces:
    operation: delete_lag_subinterfaces
    lag_config_file: "sample_lag_interface_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Deconfigure LAG using state parameter
  graphiant.naas.graphiant_lag_interfaces:
    state: absent
    lag_config_file: "sample_lag_interface_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

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 to the system.

Returned: always

Sample: true

lag_config_file

string

The LAG configuration file used for the operation.

Returned: always

Sample: "sample_lag_interface_config.yaml"

msg

string

Result message from the operation, including detailed logs when detailed_logs is enabled.

Returned: always

Sample: "Successfully configured LAG interfaces"

operation

string

The operation that was performed.

One of configure, deconfigure, add_lag_members, remove_lag_members, update_lacp_configs, or delete_lag_subinterfaces.

Returned: always

Sample: "configure"

Authors

  • Graphiant Team (@graphiant)

Collection links

  • Issue Tracker
  • Homepage
  • Repository (Sources)
  • Report an issue
  • View source code
  • Communication

© 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_lag_interfaces_module.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API