Skip to main content

CLI to access salt-api

Project description

salt-api-cli

Thin, stdlib-only Python CLI for salt-api.

Logs in once with PAM credentials, caches the token in ~/.cache/salt-api-cli/token.json, then invokes salt-api's local, runner, and wheel clients over HTTPS. The token auto-refreshes when it expires.

Installation

pip install salt-api-cli

Configuration

Configuration is resolved in this order (later sources override earlier):

  1. ~/.saltapiclirc — INI file, [salt-api-cli] section
  2. Environment variables — SALT_API_URL, SALT_API_USER, SALT_API_PASS, SALT_API_INSECURE
  3. Command-line flags — --url, --user, --password, --insecure

Example ~/.saltapiclirc:

[salt-api-cli]
url = https://salt.example.com
user = salt_api
password = secret
insecure = false

SALT_API_INSECURE=1 (or insecure = true in the config) skips TLS certificate verification.

Usage

# Local client — fan out to minions
salt local '*' test.ping
salt local 'bml*' cmd.run 'whoami'
salt local 'bml1' cmd.run 'Get-Date' shell=powershell

# Runner client (master-side: manage.status, jobs.list_jobs, ...)
salt runner manage.status
salt runner jobs.list_jobs

# Wheel client (master-side, low-level)
salt wheel key.list_all

# Key management (high-level wrapper around the wheel client)
salt keys list
salt keys accept <id-or-glob>
salt keys accept-all
salt keys reject <id-or-glob>
salt keys delete <id-or-glob>

Any key=value argument is parsed as a kwarg to the salt function; anything else is positional.

You can also invoke the CLI as a module: python -m salt_api_cli ....

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

salt_api_cli-1.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

salt_api_cli-1.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file salt_api_cli-1.1.0.tar.gz.

File metadata

  • Download URL: salt_api_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for salt_api_cli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9ecb33bc524569963e111fbe4533d4c97861bd88d143721727a7da094593dffc
MD5 1731784b93c026477fc969a99751847b
BLAKE2b-256 5f974a37729ef7108aee4fbef809f8fb60ab6550628d1bdfed2711409bb26fcf

See more details on using hashes here.

File details

Details for the file salt_api_cli-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: salt_api_cli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for salt_api_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2a25629c8cf38a3327661ae21d902603947a30d7d975669afe2143f745f62e0
MD5 d50700a2f53842d3a6abe0985b3cf495
BLAKE2b-256 3029bd79dae4cfd7f1efaf709ea173d3043251202337e0379578361d28d6895f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page