Authentication
This guide describes how to authenticate with each platform supported by the HPE Aruba Networking Central Ansible Collection: New Central, HPE GreenLake Platform (GLP), and Classic Central. You only need to configure the platforms your playbooks actually call.
Overview
Most modules in this collection support two authentication approaches:
| Approach | How It Works | Best For |
|---|---|---|
| Direct credentials (recommended) | Pass client_id and client_secret directly to each module — the module handles token generation automatically | Most playbooks; avoids token expiry issues in longer runs |
| Token module | Generate a token once with a *_token module and pass access_token to tasks | Short playbooks where you want a single token exchange at play start |
Classic Central modules only accept a pre-generated access_token — automatic token generation is not supported for that platform.
Security NoteAlways use
no_log: trueon any task that handles credentials or tokens. Store secrets in Ansible Vault or environment variables rather than plain text.
New Central
Prerequisites
- Base URL — The API gateway URL for your Central account (e.g.,
https://us4.api.central.arubanetworks.com). See Finding Your Base URL. - Client ID & Client Secret — Create credentials using the Access Token guide.
Option 1 — Pass Credentials Directly (recommended)
Pass client_id and client_secret to each module. The module handles token generation internally on every call, so tokens never go stale regardless of how long the playbook runs.
- name: Manage Central resources with direct credentials
hosts: localhost
gather_facts: no
tasks:
- name: Get devices from Central
arubanetworks.hpeanw_central.central_api:
base_url: "{{ central_base_url }}"
client_id: "{{ central_client_id }}"
client_secret: "{{ central_client_secret }}"
method: GET
path: "/network-monitoring/v1alpha1/devices"
register: devices_result
- name: Create a VLAN profile
arubanetworks.hpeanw_central.central_profiles:
base_url: "{{ central_base_url }}"
client_id: "{{ central_client_id }}"
client_secret: "{{ central_client_secret }}"
name: 100
path: "layer2-vlan"
config_dict:
vlan: 100
name: "Corp-VLAN"
description: "Corporate VLAN for main office"
state: mergedOption 2 — Generate a Token with central_token
central_tokenGenerate a token once at play start and pass it to subsequent tasks. Suitable for short playbooks where the token won't expire before the play completes (Central tokens are valid for 2 hours).
- name: Authenticate and manage Central resources
hosts: localhost
gather_facts: no
tasks:
- name: Generate Central OAuth token
arubanetworks.hpeanw_central.central_token:
base_url: "{{ central_base_url }}"
client_id: "{{ central_client_id }}"
client_secret: "{{ central_client_secret }}"
register: token_result
no_log: true
- name: Get devices from Central
arubanetworks.hpeanw_central.central_api:
base_url: "{{ central_base_url }}"
access_token: "{{ token_result['access_token'] }}"
method: GET
path: "/network-monitoring/v1alpha1/devices"
register: devices_result
- name: Create a site in Central
arubanetworks.hpeanw_central.central_sites:
base_url: "{{ central_base_url }}"
access_token: "{{ token_result['access_token'] }}"
site_attributes:
name: SJ_Office
address: "123 Main St"
city: "San Jose"
state: "California"
country: "United States"
zipcode: "12345"
timezone: "America/Los_Angeles"
state: mergedModules that support direct Central credentials: central_api, central_device_groups_info, central_devices_info, central_profiles, central_sites, central_sites_info, central_troubleshooting
HPE GreenLake Platform (GLP)
Prerequisites
- Client ID & Client Secret — Create a Personal API Client on HPE GreenLake by following these steps. No base URL is required; GLP's endpoint is fixed.
Option 1 — Pass Credentials Directly (recommended)
Pass client_id and client_secret to each module. The module handles token generation internally, which is especially important for GLP since tokens expire after 15 minutes.
- name: Query GLP resources with direct credentials
hosts: localhost
gather_facts: no
tasks:
- name: Get all devices in GLP
arubanetworks.hpeanw_central.glp_devices_info:
client_id: "{{ glp_client_id }}"
client_secret: "{{ glp_client_secret }}"
register: devices_result
- name: Make a custom GLP API call
arubanetworks.hpeanw_central.glp_api:
client_id: "{{ glp_client_id }}"
client_secret: "{{ glp_client_secret }}"
method: GET
path: "/subscriptions/v1/subscriptions"
register: subscriptions_resultOption 2 — Generate a Token with glp_token
glp_tokenGenerate a token once and reuse it across tasks. Suitable only for short playbooks that complete well within GLP's 15-minute token expiry window.
- name: Authenticate and query GLP resources
hosts: localhost
gather_facts: no
tasks:
- name: Generate GLP OAuth token
arubanetworks.hpeanw_central.glp_token:
client_id: "{{ glp_client_id }}"
client_secret: "{{ glp_client_secret }}"
register: token_result
no_log: true
- name: Get all devices in GLP
arubanetworks.hpeanw_central.glp_devices_info:
access_token: "{{ token_result['access_token'] }}"
register: devices_result
- name: Make a custom GLP API call
arubanetworks.hpeanw_central.glp_api:
access_token: "{{ token_result['access_token'] }}"
method: GET
path: "/subscriptions/v1/subscriptions"
register: subscriptions_resultModules that support direct GLP credentials: glp_api, glp_devices_info, glp_devices, glp_inventory, glp_subscriptions_info
Unified Credentials (GLP + Central)
When your playbook needs to call both GLP and Central APIs, use the unified_token module. It authenticates with your GLP credentials and workspace_id, returning a single token that works for both platforms.
Prerequisites
- GLP Client ID & Client Secret — Same credentials used for GLP above.
- Workspace ID — Your HPE GreenLake workspace ID. Find it by logging in to common.cloud.hpe.com, navigating to Manage Workspace, and copying the Workspace ID.
- Base URL (only if calling Central APIs) — Your Central API gateway URL.
Generate a Unified Token with unified_token
unified_tokenGenerate a token once and pass it to tasks that need it. Because GLP tokens expire in 15 minutes, this is best suited to short playbooks. For longer runs, use direct credentials on each GLP or Central module instead.
- name: Use unified credentials for GLP and Central
hosts: localhost
gather_facts: no
tasks:
- name: Generate unified OAuth token
arubanetworks.hpeanw_central.unified_token:
client_id: "{{ glp_client_id }}"
client_secret: "{{ glp_client_secret }}"
workspace_id: "{{ glp_workspace_id }}"
register: token_result
no_log: true
- name: Get GLP devices using unified token
arubanetworks.hpeanw_central.glp_devices_info:
access_token: "{{ token_result['access_token'] }}"
register: glp_devices_result
- name: Get Central devices using unified token
arubanetworks.hpeanw_central.central_api:
base_url: "{{ central_base_url }}"
access_token: "{{ token_result['access_token'] }}"
method: GET
path: "/network-monitoring/v1alpha1/devices"
register: central_devices_resultClassic Central
Classic Central modules only accept a pre-generated access token — the collection does not support automatic token generation for this platform.
Prerequisites
- Base URL — The Classic Central API gateway URL (e.g.,
https://apigw-uswest5.central.arubanetworks.com). See the Classic Central domain URL table. - Access Token — Manually generate a token from your Classic Central account and provide it via the
access_tokenparameter. Tokens expire and must be refreshed manually.
- name: Query Classic Central
hosts: localhost
gather_facts: no
tasks:
- name: Get sites from Classic Central
arubanetworks.hpeanw_central.classic_api:
base_url: "{{ classic_base_url }}"
access_token: "{{ classic_access_token }}"
method: GET
path: "/central/v2/sites"
register: sites_resultModules that require a Classic Central access token: classic_api, classic_groups, classic_sites
MSP Token
For Managed Service Provider (MSP) workflows, use the msp_token module to generate workspace-level or tenant-scoped tokens. See MSP Automation for a full walkthrough, including iterating across tenants.
Prerequisites
- GLP Client ID & Client Secret — MSP workspace credentials.
- MSP Workspace ID — The GreenLake workspace ID for the MSP workspace.
- Tenant ID or Tenant Name (optional) — Provide either to scope the token to a specific tenant.
- name: Generate MSP tokens
hosts: localhost
gather_facts: no
tasks:
- name: Generate MSP workspace-level token
arubanetworks.hpeanw_central.msp_token:
client_id: "{{ msp_client_id }}"
client_secret: "{{ msp_client_secret }}"
msp_workspace_id: "{{ msp_workspace_id }}"
register: msp_token_result
no_log: true
- name: Generate tenant-scoped token by tenant name
arubanetworks.hpeanw_central.msp_token:
client_id: "{{ msp_client_id }}"
client_secret: "{{ msp_client_secret }}"
msp_workspace_id: "{{ msp_workspace_id }}"
tenant_name: MyTenant
register: tenant_token_result
no_log: trueThe msp_token module returns msp_access_token (workspace-level, always returned) and tenant_access_token (tenant-scoped, returned when tenant_id or tenant_name is provided).
Choosing the Right Approach
| Scenario | Recommended Approach |
|---|---|
| Any playbook against Central | Pass client_id + client_secret directly to each module |
| Any playbook against GLP | Pass client_id + client_secret directly to each module |
| Short playbook — Central only | central_token module + access_token |
| Short playbook — GLP only | glp_token module + access_token |
| Short playbook — GLP + Central | unified_token module + access_token |
| Classic Central | Pre-generated access_token (required) |
| MSP workflows | msp_token module |
Token Module Reference
| Module | Platform | Returns |
|---|---|---|
central_token | New Central | access_token |
glp_token | GLP | access_token |
unified_token | GLP + Central | access_token |
msp_token | GLP MSP | msp_access_token, tenant_access_token |
Updated 4 months ago
What’s Next
Once your credentials are configured, head to the Quickstart guide to install the collection and make your first API call.