graphiant.naas.graphiant_vrrp module – Manage Graphiant VRRP (Virtual Router Redundancy Protocol) configuration

Note

This module is part of the graphiant.naas collection (version 26.3.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_vrrp.

New in graphiant.naas 26.1.0

Synopsis

  • This module provides comprehensive VRRP management for Graphiant Edge devices.

  • Supports VRRP configuration, deconfiguration, and enable operations on both main interfaces and 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.3.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 VRRP 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

operation

string

The specific VRRP operation to perform.

configure: Configure VRRP groups on interfaces and subinterfaces.

deconfigure: Deconfigure VRRP groups from interfaces and subinterfaces.

enable: Enable existing VRRP configurations. Fails if VRRP doesn’t exist. Idempotent - skips if already enabled.

Choices:

  • "configure"

  • "deconfigure"

  • "enable"

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 VRRP configuration.

present: Maps to configure when operation not specified.

absent: Maps to deconfigure when operation 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.

vrrp_config_file

string / required

Path to the VRRP 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 VRRP definitions with device names, interface names, and VRRP group configurations.

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

  • VRRP Operations:

  • - configure: Configure VRRP groups on interfaces and subinterfaces. Creates new VRRP configurations with specified virtual router IDs and IP addresses.

  • - deconfigure: Disable VRRP groups from interfaces and subinterfaces. Idempotent - skips if VRRP is already disabled.

  • - enable: Enable existing VRRP configurations. Fails if VRRP doesn’t exist. Idempotent - skips if already enabled.

  • Configuration files support Jinja2 templating syntax for dynamic configuration generation.

  • The module automatically resolves device names to IDs.

  • Idempotency Details:

  • The module queries existing VRRP state before making changes. For deconfigure operations, it checks if VRRP is already disabled and skips if so. For enable operations, it checks if VRRP is already enabled and skips if so. This ensures safe repeated execution without errors.

  • Interfaces must be configured first before applying VRRP using graphiant.naas.graphiant_interfaces module.

See Also

See also

graphiant.naas.graphiant_interfaces

Configure interfaces before setting up VRRP

Examples

- name: Configure VRRP on interfaces
  graphiant.naas.graphiant_vrrp:
    operation: configure
    vrrp_config_file: "sample_vrrp_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"
    detailed_logs: true
  register: vrrp_result

- name: Deconfigure VRRP from interfaces
  graphiant.naas.graphiant_vrrp:
    operation: deconfigure
    vrrp_config_file: "sample_vrrp_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Configure VRRP using state parameter
  graphiant.naas.graphiant_vrrp:
    state: present
    vrrp_config_file: "sample_vrrp_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Deconfigure VRRP using state parameter
  graphiant.naas.graphiant_vrrp:
    state: absent
    vrrp_config_file: "sample_vrrp_config.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"

- name: Enable existing VRRP configuration
  graphiant.naas.graphiant_vrrp:
    operation: enable
    vrrp_config_file: "sample_vrrp_config.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 to the system.

true when VRRP configuration was applied, enabled, or disabled.

false when operation was skipped due to idempotency (e.g., already enabled/disabled).

Returned: always

Sample: true

msg

string

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

Returned: always

Sample: "Successfully configured VRRP interfaces"

operation

string

The operation that was performed.

One of configure, deconfigure, or enable.

Returned: always

Sample: "configure"

vrrp_config_file

string

The VRRP configuration file used for the operation.

Returned: always

Sample: "sample_vrrp_config.yaml"

Authors

  • Graphiant Team (@graphiant)