GreenLake Activate CLI
The purpose of this is to help manage devices in HPE GreenLake Activate with an easy to use CLI interface. This tool uses the available API calls that HPE GreenLake Activate exposes for manging devices
Features
- Query Activate inventory by:
- device name
- mac address
- serial number
- folder name
- folder id
- Move devices between folders
- Create folders in Activate
- Create provisioning rules for folders (WIP)
- Generate CLI commands for allowlist entries (WIP)
Requirements
- Python 3.12 or newer
- An HPE GreenLake Activate API credential
- Network access to
activate.arubanetworks.com
Installation
I recommend installing this package with uv. Install uv if it is not already available.
Installing uv on Linux/Mac:
curl -LsSf https://astral.sh/uv/install.sh | sh
Installing uv on Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
To install the latest published package as a global command:
uv tool install greenlake-activate-cli
Verify the installation:
glcli --version
To upgrade or remove the installed CLI:
uv tool upgrade greenlake-activate-cli
uv tool uninstall greenlake-activate-cli
Install With Python and pip
Creating a virtual environment and installing the package:
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install greenlake-activate-cli
The glcli command is then available from the venv:
glcli --version
Configuration
Run the CLI glcli configure command.
glcli configure
You will be prompted to enter (paste) in your GreenLake Activate API token. This text is hidden.
This command is essentially doing this:
mkdir -p ~/.config/greenlake-activate-cli
printf 'CREDENTIAL_1=your_api_key_here\n' \
> ~/.config/greenlake-activate-cli/.env
chmod 600 ~/.config/greenlake-activate-cli/.env
Alternatively, you can set the environment variable manually:
export CREDENTIAL_1="your_api_key_here"
Credential sources are checked in this order:
- A non-empty
CREDENTIAL_1environment variable. $XDG_CONFIG_HOME/greenlake-activate-cli/.env, whenXDG_CONFIG_HOMEis set.~/.config/greenlake-activate-cli/.env..envin the current directory, retained for development and backward compatibility.
The configuration file format is:
CREDENTIAL_1=<your_api_key_here>
Usage
Query inventory by serial number:
glcli query serial PHWLKAS02 PHWLKAS03
Query inventory by MAC address:
glcli query mac aa:bb:cc:00:11:22 dd:ee:ff:33:44:55
Query inventory by folder ID or folder name:
glcli query folder 5297450
glcli query folder SiteA-South
Move a device by serial number or MAC address:
glcli move PHWLKAS02 SiteA-South
glcli move aa:bb:cc:00:11:22 5297450
Move multiple devices from a file:
glcli move serials serials.csv SiteA-South
glcli move macs mac_addresses.csv 5297450
Create a new folder in Activate:
glcli create folder Jake_test2
Serial numbers and MAC addresses can also be loaded from CSV or newline-delimited files:
glcli query serial --file serials.csv
glcli query mac --file mac_addresses.csv
Use --verbose for diagnostic logging:
glcli --verbose query serial PHWLKAS02
Exit codes are 0 for a complete result, 1 when no devices are returned, and
2 when at least one requested identifier is missing.
Troubleshooting
The installation with uv installs this package in an isolated environment and makes glcli available to run from any directory. If uv reports that its tool directory is not on your PATH, run:
uv tool update-shell
To run the tests;
uv run pytest
References
Metadata
Release files for greenlake-activate-cli 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| greenlake_activate_cli-0.4.1.tar.gz | 15.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| greenlake_activate_cli-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.3 kB
Release files / greenlake_activate_cli-0.4.1.tar.gz
| Download URL | greenlake_activate_cli-0.4.1.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2087139cfeb9ac567b74540f7f8ceec9d5248cf5b8d1f15020e7efa2cd751d0
|
|
BLAKE2b-256 checksum How to use checksums |
d7b89fd4edb62d7c44608d213ec21b28084916c518ca14a2a5649f9a334d7a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / greenlake_activate_cli-0.4.1-py3-none-any.whl
| Download URL | greenlake_activate_cli-0.4.1-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89bf00f3bca04cf7a77b33107ae94ced7a4dc56a220326a3290e3a947fabd029
|
|
BLAKE2b-256 checksum How to use checksums |
c9c909435d1ba6694205a3f2c5e0eb139a6b3e18481527d31c4974e5297ff5f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|