Giter Club home page Giter Club logo

gabgio / rduty Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 34 KB

rduty is a Python script to easily and quickly run a command or multiple commands on remote and local hosts and devices via ssh (telnet is also supported). It is also able to automate repetitive tasks on many hosts using inventory files from Ansible, or simple .ini inventory files.

License: GNU General Public License v2.0

Python 87.05% Makefile 10.52% Shell 2.43%
automation python3 python remote-execution remote-admin-tool ssh-client paramiko linux-app sysadmin-tool

rduty's Introduction

rduty

A simple and quick program to execute and automate remote commands.

rduty is a Python script to easily and quickly run a command or multiple commands on remote and local hosts and devices via ssh (telnet is also supported). It is also able to automate repetitive tasks on many hosts using inventory files from Ansible, or simple .ini inventory files.

rduty is currently tested on Python3, it hasn't been tested yet on other Python versions.

Installation

Python3 is needed, other than that, the rduty package is installation is very simple, but there are some dependencies which you might have to install as well:

$ sudo pip install paramiko
$ make install

By default rduty will be installed with the '/usr/local' prefix. You can change this by passing 'PREFIX=the_prefix' to make:

$ make PREFIX=/usr install

When rduty is executed it will check for the needed dependencies and report if anything is missing.

Usage

Usage: rduty [HOST or INVENTORY] [COMMAND or SCRIPT] ...

Some usage examples:

$ rduty -H 192.168.0.10 -C "ls"
$ rduty -H 192.168.0.10,192.168.0.20,server.mydomain.local -C "uname -a"
$ rduty -I myinventory/servers.ini --script "/home/user/commands_list.txt"
$ rduty -I myinventory/servers.ini --script "/home/user/commands_list.txt" --dryrun

Options:

Option Description
Required arguments:  
-H, --hosts host1,host2,... A hostname or IP, or a comma separated list of hosts
-I, --inventory FILENAME path to inventory file (.ini or Ansible format)
-C, --command COMMAND remote command to ececute on the remote hosts or devies
-S, --script FILENAME path to a list of commands to ececute on the remote hosts or devies
Optional arguments:  
-U, --username USERNAME username for the remote connection
-P, --password PASSWORD password for the remote connection
-p, --port PORT port used for the connection, default is 22
-d, --dryrun doesn't execute any command on the hosts
-q, --quiet shows essential output only
-v, --version output version information and exit.
-h, --help show this help and exit.

Script file and Inventory file format

A script is a file with a list of command to execute on the remote host, each one on a new line:

uname -a
df
hostname

A Inventory file is a .ini file with a list of hosts with the folling format:

[servers]
server1.localdomain.local
server2.localdomain.local
[dbs]
db1.localdomain.local

Command line

Usage: rduty [HOST or INVENTORY] [COMMAND or SCRIPT] ...

$ ./rduty.py  -H 192.168.0.3 -C "uname" -p 22
Username: gabriele
Password:
1. [192.168.0.3:22]
192.168.0.3 -> Connect
192.168.0.3 -> Executing command: uname
192.168.0.3 -> Getting output:
-----------------------------------------------------------------------------------------------------------------------
Linux
-----------------------------------------------------------------------------------------------------------------------
192.168.0.3 -> Connection closed.

Contact

The latest version of rduty is available on GitHub https://github.com/gabgio/rduty . For questions, bug reports, suggestions, etc. please contact the author.

License

This software is licensed under the GNU GPL2.

© 2020 Gabriele Giorgetti.

rduty's People

Contributors

gabgio avatar

Watchers

 avatar

Forkers

x00b

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.