HomeGuidesAPI ReferenceGuidesMRT APIConfiguration API
GitHubAirheads Developer Community
Guides

Assigning Devices to Applications and Subscriptions in GLP

📘

Source Code

You can find this playbook in the collection repository: examples/glp_devices.yml

This playbook generates a GLP token, then assigns a device already in GLP inventory to an application (HPE Aruba Networking Central) and a subscription key — the step that makes a device manageable from Central.

Prerequisites

  • A GLP workspace with API access enabled
  • A client_id and client_secret for GLP
  • Devices already added to GLP inventory (see the Onboarding workflow if they aren't yet)
  • A valid subscription key with available seats

Installation

  1. Install the collection from Ansible Galaxy:
ansible-galaxy collection install arubanetworks.hpeanw_central
  1. Install the pycentral v2 SDK, which the collection depends on:
pip3 install --pre pycentral

This workflow is tested on collection version 2.1.1-beta. Please check compatibility before executing on older/newer versions as there may be changes.

Configuration

Credentials Configuration (inventory.yml)

all:
  hosts:
    localhost:
      ansible_connection: local # Do not change
      glp_client_id: <glp-client-id>
      glp_client_secret: <glp-client-secret>
📘

Important Links

Execution

- name: Demo HPE GreenLake Platform Devices Info
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Generate Token for Session
      arubanetworks.hpeanw_central.glp_token:
        client_id: "{{ glp_client_id }}"
        client_secret: "{{ glp_client_secret }}"
      register: token_result

    - name: Assign Devices to GLP
      arubanetworks.hpeanw_central.glp_devices:
        access_token: "{{ token_result['access_token'] }}"
        application:
          name: HPE Aruba Networking Central Internal
          region: "US West"
        subscription_key: "ED3EB30FA8A1C461A8"
        devices:
          - "PHQSLBN56K"
        state: "assigned"

Run it with:

ansible-playbook -i inventory.yml glp_devices.yml

Module Parameters

ParameterTypeRequiredDescription
deviceslistYesSerial numbers to assign/unassign
applicationdictNoTarget application, identified by id, or by name + region
subscription_keystrNoSubscription key to assign the devices to
statestrNoassigned (default) or unassigned

Output

The devices result contains the API response code, msg, and (on success) a devices list with the updated assignment details for each device.

Troubleshooting

ProblemFix
Device not found in GLPAdd the device to GLP inventory first (see the Onboarding workflow)
Subscription assignment failsConfirm subscription_key has available seats and matches the device's application
Wrong region errorsapplication.region must match the region the application instance was created in

Support


Did this page help you?