HomeGuidesAPI ReferenceGuidesMRT APIConfiguration API
GitHubAirheads Developer Community
Guides

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:

ApproachHow It WorksBest For
Direct credentials (recommended)Pass client_id and client_secret directly to each module — the module handles token generation automaticallyMost playbooks; avoids token expiry issues in longer runs
Token moduleGenerate a token once with a *_token module and pass access_token to tasksShort 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 Note

Always use no_log: true on 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: merged

Option 2 — Generate a Token with central_token

Generate 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: merged

Modules 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_result

Option 2 — Generate a Token with glp_token

Generate 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_result

Modules 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

Generate 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_result

Classic 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_token parameter. 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_result

Modules 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: true

The 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

ScenarioRecommended Approach
Any playbook against CentralPass client_id + client_secret directly to each module
Any playbook against GLPPass client_id + client_secret directly to each module
Short playbook — Central onlycentral_token module + access_token
Short playbook — GLP onlyglp_token module + access_token
Short playbook — GLP + Centralunified_token module + access_token
Classic CentralPre-generated access_token (required)
MSP workflowsmsp_token module

Token Module Reference

ModulePlatformReturns
central_tokenNew Centralaccess_token
glp_tokenGLPaccess_token
unified_tokenGLP + Centralaccess_token
msp_tokenGLP MSPmsp_access_token, tenant_access_token

What’s Next

Once your credentials are configured, head to the Quickstart guide to install the collection and make your first API call.

Did this page help you?