Maestro
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
Maestro is a simple IT automation tool to run bash scripts against local or remote servers. It will automatically pipe all output from any script run into your terminal., (*2)
KRAMER: You know you hurt the Maestro's feelings.
JERRY: Oh what, because I didn't call him Maestro?
KRAMER: That's right.
JERRY: Ya know I feel a little funny calling somebody Maestro.
KRAMER: Why?
JERRY: Because it's a stupid thing to be called.
Install
Via Composer, (*3)
``` bash
composer global require snelling/maestro, (*4)
This is still a work in progress, and probably will need to be installed by hand until I have officially tagged this repository.
## Usage
Go to any directory and init a new maestro project with the command `maestro init`
``` bash
โ maestro init
Config file & scripts directory created!
This command will create a new maestro/
folder, and put a few things in there for you.
``` bash
โ tree maestro
maestro
โโโ configuration.json
โโโ scripts
โโโ ls
โโโ pwd, (*5)
1 directory, 3 files, (*6)
The `maestro/configuration.json` file is used to define targets. A target is a local or remote machine to run a command against.
```json
{
"targets": {
"local": "127.0.0.1",
"web": "user@192.168.1.1"
}
}
You can list the available targets at any time by running maestro targets
``` bash
โ maestro targets, (*7)
Name User IP Address, (*8)
local 127.0.0.1
web user 192.168.1.1, (*9)
The `maestro/scripts/` folder is where you will put any bash script that you would like to run against a target. By default we include two commands out of the box, `ls` and `pwd`. You can list all available scripts to run by running the command `maestro scripts`
``` bash
โ maestro scripts
------ ------------------------------------
Name Description
------ ------------------------------------
ls Runs ls -al command
pwd Gets the current working directory
------ ------------------------------------
The name of the script is just the script filename. The description of the script is a bash comment inside the bash script. You need to add # @description <your description>
to make a description show up in the maestro scripts
command.
``` bash
โ cat maestro/scripts/ls, (*10)
!/usr/bin/bash
@description Runs ls -al command
set -e
ls -al, (*11)
Let's make a new script that gets a machine's hostname. Note how we include `set -e` at the top of the script to terminate output if there is an error.
``` bash
โ echo '#!/usr/bin/bash
# @description Gets the hostname of the machine
set -e
hostname' >maestro/scripts/hostname
Then, we can verify it comes up as valid script by re-running the maestro scripts
command.
``` bash
โ maestro scripts, (*12)
Name Description, (*13)
hostname Gets the hostname of the machine
ls Runs ls -al command
pwd Gets the current working directory, (*14)
Finally, you can run script against a target by running `maestro run <script name> <target name>`
``` bash
โ maestro run hostname local
Running script hostname on 127.0.0.1
[127.0.0.1]: localhost
Change log
Please see CHANGELOG for more information on what has changed recently., (*15)
Testing
bash
$ composer test
, (*16)
Contributing
Please see CONTRIBUTING and CONDUCT for details., (*17)
Security
If you discover any security related issues, please email sam@onroi.com instead of using the issue tracker., (*18)
Credits
License
The MIT License (MIT). Please see License File for more information., (*19)