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-api-cli local '*' test.ping
salt-api-cli local 'bml*' cmd.run 'whoami'
salt-api-cli local 'bml1' cmd.run 'Get-Date' shell=powershell

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

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

# Key management (high-level wrapper around the wheel client)
salt-api-cli keys list
salt-api-cli keys accept <id-or-glob>
salt-api-cli keys accept-all
salt-api-cli keys reject <id-or-glob>
salt-api-cli 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.0.0.tar.gz (6.2 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.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: salt_api_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 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.0.0.tar.gz
Algorithm Hash digest
SHA256 a43957a7482544863a5d44bdee6bdf0f0f22b890ab752e016513010f1e96e150
MD5 4bf114db5f654ee682d851cde6412102
BLAKE2b-256 bd061832d5302ccb4e88b0602623d4b1a87da2ada4cab0284990c4f7640e0b87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: salt_api_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb93f8215eb8138e0aaed8403fa42eb9c684963968a2c969ae692e13d4fbe74e
MD5 bbb994d37fde6159e75faba86a43c435
BLAKE2b-256 0fb6b3951689c633d47dfbf40f73af403108238467044b87365ccd6c0c87fba1

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