Bashible is a deployment/automation tool written in Bash (DSL). Inspired by Ansible. Simplifies things and prevents usual mistakes.
At the moment, bashible has been used on Arch linux. It may not be compatible with other platforms, because it internally uses GNU/sed, grep, etc.
Suggestions and bugfixes are welcome! :-)
@ represents a block of tasks,
- represents a task. Both
- are just bash functions with arguments.
#!/usr/local/bin/bashible # the working directory is automatically set to the script's # all tasks will stop execution immediately on failure, unless prefixed by "may_fail" @ Synchronizing files - result synced rsync -av /foo /bar @ Shutting down the machine - when synced - when test -f /etc/do-shutdown - shutdown -h now @ Sending an e-mail unless synchronization succeeded - when not synced - mail firstname.lastname@example.org <<< "synchronzation failed"
Rewritten into pure Bash, the example above could look like this,
#!/bin/bash cd `dirname $0` set -eux -o pipefail echo Synchronizing files if rsync -av /foo /bar; then echo Shutting down the machine if test -f /etc/do-shutdown; then shutdown -h now fi else echo Sending an e-mail unless synchronization succeeded mail email@example.com <<< "synchronzation failed" fi
See also examples in the example directory.
Install bashible and it's modules (sourceable functions - here just one module, "edit"). Copy everything to the same directory.
wget https://raw.githubusercontent.com/mig1984/bashible/master/bashible wget https://raw.githubusercontent.com/mig1984/bashible/master/bashible.edit chmod 755 bashible chmod 755 bashible.edit mv bashible /usr/local/bin mv bashible.edit /usr/local/bin
Run the script
bashible my-script.bash ARG1 ARG2 ...
or put she-bang in the beginning of the script and then run it directly
./my-script.bash ARG1 ARG2 ...
Write more docs and examples.
Modularize. The bashible core in the version 1.0 should contain only necessary functions and should not ever change. For instance, the delayed and unless_already COMMAND ARGS ... functions now need two temporary files. These files are created on every bashible startup. These functions should go into optional modules instead.
Create tests. Bashible uses GNU/grep, GNU/sed and other programs which may not work properly on all platforms.
Make bashible multiplatform.
Create more modules and/or integrate existing Bash libraries.