graphiant.naas.graphiant_edge_services module – Configure edge services (DHCP, DNS, LLDP, DPI, LWS password)
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_edge_services.
New in graphiant.naas 26.5.0
Synopsis
Configures Edge Services on the Edge/Gateway devices
PUT /v1/devices/{device_id}/config: LAN segmentdhcpSubnets, devicelocalWebServerPassword, LAN interfacelldpEnabled, edgednsmode (DNSModeStatic,DNSModeCloudflare, orDNSModeDynamic), and edgetrafficPolicy.dpiApplications.Edge/Gateway only; core devices are rejected. Complements graphiant.naas.graphiant_global_config (syslog, IPFIX, SNMP) and graphiant.naas.graphiant_ntp (NTP). For unstructured payloads, graphiant.naas.graphiant_device_config can push raw edge branch JSON instead.
Supply
edge_services_config_filefor a bulkedge_serviceslist, and/ordevicewith service fields to run a single device or override one device from the file.DHCP subnet keys in the API combine interface name and
ipPrefixwith a hyphen. Remove a subnet withstate: absentin YAML (sendssubnet: null). Static lease IPs must not fall inside configured DHCP ranges.Local web server passwords are hashed in GET responses; the module cannot compare plaintext to the portal. Diff output uses
localWebServerPasswordConfiguredbooleans. WithoutlocalWebServerPasswordForce(default),localWebServerPasswordis pushed only when the device has none configured; if a hash already exists, LWS is skipped. SetlocalWebServerPasswordForceto push when one is already configured. IflocalWebServerPasswordForceis true,localWebServerPasswordmust be supplied via YAML,vault_devices_lws_password(matching device key), or module parameters—the task fails otherwise. Clear force after a successful rotate (portal hash makes force non-idempotent). Supply passwords vialocalWebServerPasswordin YAML (dev/local; do not commit secrets),vault_devices_lws_password(Ansible Vault; recommended), or module parameters. Precedence is YAMLlocalWebServerPasswordovervault_devices_lws_password. Config files support self-contained Jinja2 (for loops, set blocks); playbook/Ansible variables are not available at render time—pass vault dicts via the module parameter afterinclude_vars.Idempotent merge for DNS mode, LLDP, and DHCP fields. Configure-only (no deconfigure operation).
Module parameters use camelCase names aligned with the API (
dhcpSubnets,dpiApplications,localWebServerPassword,localWebServerPasswordForce). Legacy snake_case aliases (dhcp_subnets,dpi_applications, etc.) are still accepted.DPI applications are pushed under
edge.trafficPolicy.dpiApplicationsas a map keyed by application name. The map key is used asapplication.namein the PUT payload whennameis omitted in YAML. Each value wrapsapplicationfields (ipProtocol, networks, ports, and optional references tosourceNetworkList,destinationNetworkList,sourcePortList,destinationPortListnames defined underedge.trafficPolicyvia graphiant.naas.graphiant_prefix_port_list). Usestate: absenton a map entry to remove an application (sendsapplication: null). Idempotency compares non-null fields present in YAML; omitted keys and explicitnullare ignored (the portal does not clear nested match fields via null). Portal-only fields such asdescriptionare ignored unless set in YAML.
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 in the task result message. Choices:
|
|
Portal device hostname for Required when |
|
List of DHCP subnet entries (segment, interface, ipPrefix, subnet dict, optional Each API subnet key is interface name and |
|
Edge DNS settings. For static mode, set |
|
Map of DPI application name to The map key is the application name in the API; Use |
|
Path to YAML (optional if Relative paths resolve using the collection config path (see Top-level key |
|
Graphiant portal host URL for API connectivity. Example: “https://api.graphiant.com” |
|
Map of LAN interface names to The task fails if a key names a WAN/circuit interface or an interface that does not exist on the device. |
|
Plaintext local web server password (API May be set in Without |
|
When Requires Choices:
|
|
Only Choices:
|
|
Graphiant portal password for authentication. Required for password-based login when no valid bearer token is available from |
|
Only Choices:
|
|
Graphiant portal username for authentication. Required for password-based login when no valid bearer token is available from |
|
Map of portal device hostname to local web server password (from Ansible Vault via Do not reference Ansible/playbook variables inside the config file; pass this dict as this module parameter after Default: |
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. Payloads that would be pushed are logged with a |
Supports check mode similarly to other device config modules. |
|
Support: full When the playbook runs with |
Supports Ansible’s |
Notes
Note
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. Use--diffto previewdetails.diff_planand Ansiblediff.
See Also
See also
- graphiant.naas.graphiant_device_system
Configure device name, region, and site.
- graphiant.naas.graphiant_interfaces
Configure LAN/WAN interfaces before DHCP subnets and LLDP.
- graphiant.naas.graphiant_global_config
Global syslog, IPFIX, and SNMP (not edge DHCP/DNS/LLDP/LWS).
- graphiant.naas.graphiant_ntp
NTP configuration (separate from edge DNS mode).
- graphiant.naas.graphiant_device_config
Push raw device JSON when structured modules are not used.
Examples
- name: Configure edge services from YAML
graphiant.naas.graphiant_edge_services:
operation: configure
edge_services_config_file: "sample_edge_services.yaml"
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
detailed_logs: true
register: edge_result
- name: Enable LLDP on LAN interfaces for one device
graphiant.naas.graphiant_edge_services:
operation: configure
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
device: "edge-10-joule-sj-dr"
lldp:
GigabitEthernet4/0/0: true
GigabitEthernet8/0/0: true
detailed_logs: true
- name: Set Cloudflare DNS mode
graphiant.naas.graphiant_edge_services:
operation: configure
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
device: "edge-10-joule-sj-dr"
dns:
mode: DNSModeCloudflare
- name: Add DHCP pool on a LAN segment
graphiant.naas.graphiant_edge_services:
operation: configure
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
device: "edge-2-sdktest"
dhcpSubnets:
- segment: lan-1-test
interface: GigabitEthernet8/0/0
ipPrefix: "10.2.11.0/24"
state: present
subnet:
name: Edge-2-lan-1-test-DHCP
ipGateway: "10.2.11.1"
ipRangesV2:
ipRange:
- start: "10.2.11.100"
end: "10.2.11.200"
state: present
- name: Configure edge services from YAML with vault LWS passwords
# Load vault_secrets.yml with M(ansible.builtin.include_vars) first (see edge_services_management.yml).
- name: Apply edge services (LWS passwords from vault_devices_lws_password)
graphiant.naas.graphiant_edge_services:
operation: configure
edge_services_config_file: "sample_edge_services.yaml"
vault_devices_lws_password: "{{ vault_devices_lws_password | default({}) }}"
host: "{{ graphiant_host }}"
username: "{{ graphiant_username }}"
password: "{{ graphiant_password }}"
detailed_logs: true
no_log: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
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 |
|
Path to the YAML file used, if any. Returned: when provided |
|
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 |