Skip to main content

pypsh - cli for parallel ssh command execution on all known hosts that match a given regex.

Project description

To execute a command on a group of hosts matching a given regular expression:

pypsh cmd <hostregex> <cmd-to-execute>

E.g.:

pypsh cmd "role\d+\.customer\.your\.domain" "uptime"

Or to copy a given file to a group of hosts:

pypsh copy /tmp/here/myfile.txt "my\.domains\d+\.com" /tmp/remote/file.txt

To list the hosts that would match use the following command:

pypsh show <hostregex>

The command or file copy operation will be executed on any host that is in the known_hosts file and matches the given regular expression.

Installation

Pypsh can be installed using pip:

pip install pypsh

Development

To work on pypsh checkout the git repository, create a virtual environment and install the dependencies:

git clone https://github.com/mfussenegger/pypsh.git
cd pypsh
mkvirtualenv pypsh
pip install -r requirements.txt

Sometimes it is useful to point the pypsh command to the local development branch:

pip install --upgrade --force-reinstall --editable .

But usually it is sufficient to invoke it like this:

python pypsh/main.py {cmd,copy} ...

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

pypsh-0.5.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Supported by

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