Assigning Devices to Applications and Subscriptions in GLP
Source CodeYou 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_idandclient_secretfor GLP - Devices already added to GLP inventory (see the Onboarding workflow if they aren't yet)
- A valid subscription key with available seats
Installation
- Install the collection from Ansible Galaxy:
ansible-galaxy collection install arubanetworks.hpeanw_central- Install the
pycentralv2 SDK, which the collection depends on:
pip3 install --pre pycentralThis 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.ymlModule Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
devices | list | Yes | Serial numbers to assign/unassign |
application | dict | No | Target application, identified by id, or by name + region |
subscription_key | str | No | Subscription key to assign the devices to |
state | str | No | assigned (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
| Problem | Fix |
|---|---|
| Device not found in GLP | Add the device to GLP inventory first (see the Onboarding workflow) |
| Subscription assignment fails | Confirm subscription_key has available seats and matches the device's application |
| Wrong region errors | application.region must match the region the application instance was created in |
Support
- Automation Team: [email protected]
- Collection Issues: GitHub Issues
Updated 4 months ago
Did this page help you?