Created
May 14, 2016 03:41
-
-
Save mahemoff/5febd49128dfa5cae24243968f2289c4 to your computer and use it in GitHub Desktop.
ansible control script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
############################## | |
# CORE COMMANDS | |
############################## | |
function ap { ansible-playbook -i $inventory $* ; } | |
function flush_cache { ansible-playbook --flush-cache ; } | |
############################## | |
# LOAD BALANCERS COMMANDS | |
############################## | |
function load_balancers { ap load_balancers.yml ; } | |
function restart_load_balancers { ap load_balancers.yml --tags restart; } | |
# etc | |
# etc | |
############################## | |
# CALL IT | |
############################## | |
start_time=`date +%s` | |
echo `date`" Running $command on $renv" | |
eval ${command_func} $* | |
end_time=`date +%s` | |
duration=$(( end_time - start_time )) | |
echo `date`" Finished Ansible $original_args (duration: $duration secs)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment