Skip to main content

A command-line tool to execute commands on multiple remote hosts

Project description

Ananta (formerly Hydra)

Ananta is a powerful command-line tool designed to simplify simultaneous SSH command execution across multiple remote hosts. It enhances workflows, automates repetitive tasks, and improves efficiency for system administrators and developers managing distributed systems.

Namesake

Ananta draws inspiration from Ananta Shesha or Ananta Nagaraja (อนันตนาคราช), the many-headed serpentine demigod from Hindu mythology deeply rooted in Thai culture.

Initially, this project was named Hydra, referencing the many-headed serpent in Greek mythology. However, due to the abundance of projects named Hydra or hydra-* on PyPI (e.g., the previous project at https://pypi.org/project/hydra-ssh/), it was renamed to Ananta. The commands you now use are ananta, which is shorter, more distinctive, and easier to remember than hydra-ssh.

Features

  • Concurrent execution of commands across multiple remote hosts
  • Flexible CSV-based host list configuration
  • SSH authentication with public key support
  • Lightweight and user-friendly command-line interface
  • Color-coded output for easy host differentiation
  • Option to separate host outputs for clarity
  • Support for cursor control codes for specific layouts (e.g., fastfetch, neofetch)

Installation

System Requirements

  • Python 3.10 or higher
  • pip package manager
  • Required dependencies: asyncssh, argparse, asyncio
  • Optional: uvloop (Unix-based systems) or winloop (Windows) for enhanced performance

Installing via pip

Install Ananta using pip:

pip install ananta --user

Install Ananta using pip with uvloop or winloop for speed enhancement:

pip install ananta[speed] --user

Note: Ensure Python 3.10 or higher is installed on your system.
If you previously used hydra-ssh, update your command to pip install ananta to access the latest version.

Usage

Hosts File Format

Create a hosts file in CSV format with the following structure:

#alias,ip,port,username,key_path
host-1,10.0.0.1,22,user,/home/user/.ssh/id_ed25519
host-2,10.0.0.2,22,user,#
  • Lines beginning with # are ignored.
  • key_path details:
    • Provide the path to an SSH private key.
    • Use # to indicate the default key specified via the -K option.
    • If # is used without -K, Ananta will attempt to use commonly available SSH keys from ~/.ssh/.

Running Commands

Run commands on remote hosts with:

ananta <options> [hosts file] [command]

Example:

$ ananta hosts.csv uptime
$ ananta -S sensors
$ ananta -CS hosts.csv fastfetch

Options

  • -N, --no-color: Disable colorized output
  • -S, --separate-output: Display output from each host separately
  • -W, --terminal-width: Manually set terminal width
  • -E, --allow-empty-line: Permit printing of empty lines
  • -C, --allow-cursor-control: Enable cursor control codes (e.g., for fastfetch or neofetch)
  • -V, --version: Display the Ananta version
  • -K, --default-key: Specify the default SSH private key path

Demo

asciicast

asciicast

License

The MIT License (MIT)

Copyright (c) 2023-2025 cwt(at)bashell(dot)com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

ananta-1.0.4.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

ananta-1.0.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file ananta-1.0.4.tar.gz.

File metadata

  • Download URL: ananta-1.0.4.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.8 Linux/6.4.16-cwt.x86_64

File hashes

Hashes for ananta-1.0.4.tar.gz
Algorithm Hash digest
SHA256 f5879292cb3bb662ba36159d64d5547b97c309a4f30bf837ad68f60a22ea8194
MD5 a655321e07e9ee5a9202561f15f962e7
BLAKE2b-256 bd8f067fe6958bbeda98281f5089f50805bfe6f8294ee8a39b8a1c29627d3460

See more details on using hashes here.

File details

Details for the file ananta-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: ananta-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.8 Linux/6.4.16-cwt.x86_64

File hashes

Hashes for ananta-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf54cb1eef7f9811523fa31d303b723a7be8f41ddbaa0c31b9a64c5ebc754b7
MD5 7f96355bd840203af39507e82c0a5824
BLAKE2b-256 1cf6ae0dc27856c1e4d5c4dd65580d0b77d1a49e94db4416d785fae1f8d8b399

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