HomeGuidesAPI ReferenceGuidesMRT APIConfiguration API
GitHubAirheads Developer Community
Guides

Quickstart Guide

This guide walks through installing the HPE Aruba Networking Central Ansible Collection and making your first API call to New Central and/or GLP.

Installation

ansible-galaxy collection install arubanetworks.hpeanw_central

The collection depends on the pycentral v2 SDK:

pip3 install --pre pycentral

Validate the install:

ansible-galaxy collection list | grep hpeanw_central

Prerequisites

Before running any playbook, make sure you've completed the Authentication guide to set up your credentials. The examples below assume you have an inventory.yml with your New Central and GLP credentials:

all:
  hosts:
    localhost:
      ansible_connection: local
      central_base_url: <central-api-base-url>
      central_client_id: <central-client-id>
      central_client_secret: <central-client-secret>
      glp_client_id: <glp-client-id>
      glp_client_secret: <glp-client-secret>

Examples

The examples below demonstrate two ways to use the collection:

  1. A direct API call using the generic central_api/glp_api modules.
  2. The same data retrieved using a purpose-built *_info module.

Start with the generic API modules if you're new to the collection — they map 1:1 to the REST API and don't require learning module-specific parameters.

Direct API call with central_api

The central_api module is a thin wrapper around the New Central REST API — it can call any endpoint with full customization over method, path, query parameters, and request body. This example fetches the devices assigned to your Central application.

- name: Get devices from Central
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Fetch device inventory
      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

    - debug:
        var: devices_result.result.msg

Execute:

ansible-playbook -i inventory.yml get_devices.yml

If successful, devices_result.result.msg contains the raw API response, and devices_result.result.code is 200. A device entry looks like:

{
  "serialNumber": "CNSKKLB00C",
  "status": "ONLINE",
  "deviceType": "GATEWAY",
  "model": "9004-US",
  "deviceName": "Aruba9004_63_89_1E",
  "macAddress": "f0:1a:a0:63:89:1e",
  "ipv4": "0.0.0.0",
  "siteName": "LSV-WPA3-PSK-Site",
  "deviceGroupName": "ADL-Lucas",
  "softwareVersion": "10.7.2.2_94048",
  "isProvisioned": "Yes"
}

GLP API Calls

The GLP device inventory endpoint returns devices in your GLP account. Use glp_api the same way, with GLP credentials instead of Central's:

- name: Get devices from GLP
  arubanetworks.hpeanw_central.glp_api:
    client_id: "{{ glp_client_id }}"
    client_secret: "{{ glp_client_secret }}"
    method: GET
    path: "/devices/v1/devices"
  register: glp_devices_result

Fetch devices using a purpose-built module

The central_api example above returns whatever a single API call gives back. Some Central and GLP endpoints paginate large result sets, and calling central_api/glp_api repeatedly to page through them is extra work. Purpose-built *_info modules like central_devices_info and glp_devices_info handle that for you and return an already-assembled devices list.

- name: Get all devices in Central using a purpose-built module
  arubanetworks.hpeanw_central.central_devices_info:
    base_url: "{{ central_base_url }}"
    client_id: "{{ central_client_id }}"
    client_secret: "{{ central_client_secret }}"
    subset: all_devices
  register: devices_result

- debug:
    var: devices_result.devices

*_info modules also support narrower lookups through their subset parameter — for example, central_devices_info supports device_by_serial, device_by_id, and device_by_filter in addition to all_devices. Browse each module's arguments in the collection's module reference to see what's available.

📘

Which should you use?

Use the generic central_api/glp_api/classic_api modules while exploring an API or reaching an endpoint the collection doesn't wrap yet. Move to a purpose-built module once you know you're calling the same operation repeatedly — you get idempotent state handling, pagination, and parameter validation for free.

The examples above are a foundation for your own playbooks. From here, the Example Workflows walk through complete, multi-step automations — onboarding devices, creating sites and groups, and building configuration profiles — that combine these same modules.


What’s Next

Take a look at workflows built with the collection

Did this page help you?