graphiant.naas.graphiant_ntp module – Manage device-level NTP objects (edge.ntpGlobalObject)

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

New in graphiant.naas 26.2.0

Synopsis

  • Configure or delete device-level NTP objects under edge.ntpGlobalObject.

  • Reads a structured YAML config file and builds the raw device-config payload in Python.

  • Configure is idempotent: compares intended objects to existing device state and skips push when already matched.

  • Deconfigure deletes only the objects listed in the YAML by setting config: null per object.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.7

  • graphiant-sdk >= 25.12.1

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.

Choices:

  • false ← (default)

  • true

host

aliases: base_url

string / required

Graphiant portal host URL for API connectivity.

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

ntp_config_file

string / required

Path to the NTP YAML file.

Can be an absolute path or relative to the configured config_path.

Expected top-level key is ntpGlobalObject (list of devices).

operation

string

Specific operation to perform.

configure creates/updates NTP objects listed in the config.

deconfigure deletes listed NTP objects by setting config=null.

Choices:

  • "configure"

  • "deconfigure"

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

Desired state for NTP objects.

present maps to configure; absent maps to deconfigure if operation not set.

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

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 [check_mode] prefix.

Supports check mode.

Notes

Note

  • This module manages NTP objects directly on devices (device config API), not the portal-wide global config.

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

  • Deconfigure payload uses config: null per object; this module preserves nulls in the final payload pushed to the API.

Examples

- name: Configure device-level NTP objects
  graphiant.naas.graphiant_ntp:
    operation: configure
    ntp_config_file: "sample_device_ntp.yaml"
    host: "{{ graphiant_host }}"
    username: "{{ graphiant_username }}"
    password: "{{ graphiant_password }}"
    detailed_logs: true
  register: ntp_result
  no_log: true

- name: Deconfigure device-level NTP objects
  graphiant.naas.graphiant_ntp:
    operation: deconfigure
    ntp_config_file: "sample_device_ntp.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 would push config to at least one device.

In check mode (--check), no configuration is pushed, but changed reflects whether changes would be made.

Returned: always

configured_devices

list / elements=string

Device names where configuration was pushed (when changed=true).

Returned: when supported

msg

string

Result message (includes detailed logs when enabled).

Returned: always

ntp_config_file

string

The NTP config file used for the operation.

Returned: always

operation

string

The operation performed.

Returned: always

skipped_devices

list / elements=string

Device names that were skipped because desired state already matched.

Returned: when supported

Authors

  • Graphiant Team (@graphiant)