Skip to main content

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
    • provisioning rules
  • Move devices between folders
  • Create folders in Activate
  • Create provisioning rules for folders
  • Generate CLI commands for CAP and RAP allowlist entries

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:

  1. A non-empty CREDENTIAL_1 environment variable.
  2. $XDG_CONFIG_HOME/greenlake-activate-cli/.env, when XDG_CONFIG_HOME is set.
  3. ~/.config/greenlake-activate-cli/.env.
  4. .env in 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

Query provisioning rules for one folder by ID or name:

glcli query rule folder-id 63111131
glcli query rule folder-name Northwest

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

Create a provisioning rule for a folder by ID or name:

glcli create rule folder-id 63061537
glcli create rule folder-name Northwest

Generate allowlist commands for devices in a folder. The --text option allows you to generate a text file with the commands if you prefer.

Example:

glcli generate-allowlist cap folder SiteA-South
glcli generate-allowlist rap folder SiteA-South --description "Remote site"
glcli generate-allowlist cap folder SiteA-South --text

Generate allowlist commands from a CSV file:

glcli generate-allowlist cap file allowlist.csv
glcli generate-allowlist rap file allowlist.csv
glcli generate-allowlist rap file allowlist.csv --text

The CSV must have mac_address and ap_group headers. RAP files must also have a serial header. The optional description column applies to that row. For example:

mac_address,ap_group,serial,description
AA:BB:CC:00:11:22,remote,SN123,North site

The create rule command is strictly for creating provisioning rules. The command prompts for the rule name, provision type (cap or rap), controller IP, and AP group. Perhaps in the future, I'll add the ability to create notification rules.

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

When in doubt, restart your shell.

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 for development:

uv run pytest

References

Metadata

Release files for greenlake-activate-cli 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for greenlake-activate-cli 0.6.2
File Size Uploaded Provenance
greenlake_activate_cli-0.6.2.tar.gz 22.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for greenlake-activate-cli 0.6.2
File Interpreter ABI Platform
greenlake_activate_cli-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 41.6 kB

Release files / greenlake_activate_cli-0.6.2.tar.gz

Download URL greenlake_activate_cli-0.6.2.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
18bdf51530a2ad0c98d51c9f3b65adaf4c7bd13ec35c7a726fd93a280cf52054
BLAKE2b-256 checksum
How to use checksums
23fe51f63155ec7801d94aad81a36dbf582356e582bea2d281701210e8d08e96
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.6.2-py3-none-any.whl

Download URL greenlake_activate_cli-0.6.2-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39ac79dd1a6f08b722b000807a28b186400287f12a658fbd31e9726d768fb378
BLAKE2b-256 checksum
How to use checksums
a864c6c974b4ac53b531fc23638d5e99ce8a66dc55c17cbb4ba678be8874baa1
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}

Security for greenlake-activate-cli 0.6.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page