graphiant.naas.graphiant_device_system module – Configure device name, region, and site (Edge or Core)
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_device_system.
New in graphiant.naas 26.4.0
Synopsis
Sets
name,regionName, andsiteon theedgeorcoreobject forPUT /v1/devices/{device_id}/config, matching https://github.com/Graphiant-Inc/graphiant-sdk-python/blob/main/docs/V1DevicesDeviceIdConfigPutRequest.md.YAML and module options use the same keys as the API branch payload (except optional
device_type, which selects theedgevscorebranch and is not sent in the request body).After
GET /v1/devices/{id}, the module maps portalroleto the config branch (core→core,cpe→edge) whendevice_typeis omitted. Ifdevice_typeis set, it must match that mapping.Supply
system_config_filefor a bulkdevice_systemlist, and/ordevicewithname/regionName/siteto run a single device or to override one device from the file.Only keys you set are merged onto current device state; omitted keys are left unchanged.
Validates portal site exists when
site.nameis set.Idempotent when the merged payload already matches the device. Current state is read from
GET /v1/devices/{id}usinghostnameasname,regionOverride.namewhen set elseregion.nameasregionName, andsite.nameassite, aligned with the portal device object.Omit
siteentirely to leave the portal site unchanged. A YAMLsitekey with an empty value or withoutnameis treated as unspecified (not a request to clear site).If a device has no site in the portal and your desired config also omits
site, a config push is not attempted, because the API can reject the update. The module fails the task, andskipped_no_sitelists the affected hostnames. No other device in the same play is updated in that run (aborted) until you assign a site in the portal or setsitein YAML.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.7
graphiant-sdk >= 26.4.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 in the task result message. Choices:
|
|
Portal device name for Required when |
|
Selects the Optional. If omitted, the branch is taken from the device’s portal Choices:
|
|
Graphiant portal host URL for API connectivity. Example: “https://api.graphiant.com” |
|
Device hostname (API |
|
Only Choices:
|
|
Graphiant portal password for authentication. Required for password-based login when no valid bearer token is available from |
|
Device’s region name (API |
|
Site object (API |
|
Only Choices:
|
|
Path to YAML (optional if Relative paths resolve using the collection config path (see Top-level key |
|
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; the module still reads current device state to determine whether changes would be made. |
Supports check mode similarly to other device config modules. |
|
Support: full When the playbook runs with |
Supports Ansible’s |
Notes
Note
Deconfigure is not supported; apply desired values with
operation=configure.Configuration files support Jinja2 templating syntax for dynamic value substitution.
With
ansible-playbook --check, writes are skipped butchangedreflects whether an apply would update at least one device, unless a device fails the no-site rule, in which case the task fails andchangedis false. Use--diffwith check mode to preview branch changes when a run would succeed.
See Also
See also
- graphiant.naas.graphiant_device_config
Push arbitrary raw device configuration payloads.
- graphiant.naas.graphiant_sites
Create and manage sites referenced in
site.name.
Examples
- name: Configure from YAML (device_system list)
graphiant.naas.graphiant_device_system:
operation: configure
system_config_file: "sample_device_system.yaml"
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
detailed_logs: true
register: sys_result
- name: Single device from module parameters (branch from portal role if device_type omitted)
graphiant.naas.graphiant_device_system:
operation: configure
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
device: "edge-3-sdktest"
name: "edge-3-sdktest"
regionName: "us-east-2 (Atlanta)"
site:
name: "New York-sdktest"
detailed_logs: true
- name: Override site for one device from the file
graphiant.naas.graphiant_device_system:
operation: configure
system_config_file: "sample_device_system.yaml"
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
device: "edge-3-sdktest"
site:
name: "San Jose-sdktest"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Returned: on failure, when a batch was aborted |
|
Whether configuration was pushed to at least one device. Returned: always |
|
Device names where an update was applied. Returned: when supported |
|
Structured payload from the manager (device lists, Returned: always |
|
Ansible Returned: when playbook uses |
|
Human-readable result (includes detailed logs when enabled). Returned: always |
|
Operation performed (always Returned: always |
|
Device names skipped because state already matched. Returned: when supported |
|
Device names for which a push was not attempted because the portal has no site on the device and the desired edge/core payload has no Returned: failure |
|
Path to the YAML file used, if any. Returned: when provided |
|
When the task fails for Returned: on failure, when a batch was aborted |