diff options
author | Matthieu Saulnier <fantom@fedoraproject.org> | 2018-12-29 15:18:59 +0100 |
---|---|---|
committer | Matthieu Saulnier <fantom@fedoraproject.org> | 2018-12-29 15:18:59 +0100 |
commit | f07011b6810843cbd1b5dc855157d8f894328c32 (patch) | |
tree | ec05cb6c9c31abe63248e62eb0bf4613bcfa2c4f /replay | |
parent | 9c08641dea1722ede21b0ce8198d226ba5e95927 (diff) | |
download | playbooks-ansible-f07011b6810843cbd1b5dc855157d8f894328c32.tar.gz playbooks-ansible-f07011b6810843cbd1b5dc855157d8f894328c32.tar.xz playbooks-ansible-f07011b6810843cbd1b5dc855157d8f894328c32.zip |
Move bash script in bin subdirectory
Diffstat (limited to 'replay')
-rwxr-xr-x | replay | 99 |
1 files changed, 0 insertions, 99 deletions
@@ -1,99 +0,0 @@ -#!/usr/bin/bash - -### -# User variables, you may edit these variables -### -SOURCES=$HOME/park-admin/playbooks-ansible -WORKDIR=$SOURCES -COUNTLIMIT=10 -# Availables options are: 'clearnet' or 'tornetwork' -NETWORK=clearnet -FORK=8 -TIMEOUT=240 -FLAGS="--force-handlers --skip-tags hidsdb -f $FORK -T $TIMEOUT" -### -# Stop editing, it is ready -### - - -# sortie formatée des logs -OK="\e[0m[ \e[92mOK\e[0m ]" -ERROR="\e[0m[ \e[91mERROR\e[0m ]" -INFO="\e[0m[ \e[93mINFO\e[0m ]" - - -### -# User command-line options -### -while [[ $# -gt 0 ]] -do - case "$1" in - -d|--debug) - COUNTLIMIT=2 - shift - ;; - *) - echo "Usage: $0 [-d|--debug]" - exit 3 - ;; - esac -done -### -# End -### - - -REPLAY=true -COUNT=1 - -pushd $WORKDIR >/dev/null - -if [[ $NETWORK == "clearnet" ]] -then - CMDLINE=ansible-playbook-3 - HOSTFILE=$SOURCES/hosts.net -elif [[ $NETWORK == "tornetwork" ]] -then - CMDLINE="torsocks ansible-playbook-3" - HOSTFILE=$SOURCES/hosts.tor -fi - -# need cleanup before starting loop -if [[ -f $SOURCES/site.retry ]] -then - rm -f $SOURCES/site.retry - echo -e "$ERROR retry file found, cleaning up..." -else - echo -e "$OK retry file not found, starting loop..." -fi - - -while [[ $REPLAY == "true" ]] && [[ $COUNT -lt $COUNTLIMIT ]] -do - if [[ -f $SOURCES/site.retry ]] - then - LIMIT="--limit @${SOURCES}/site.retry" - echo -e "$OK retry file found" - else - LIMIT="" - echo -e "$INFO retry file not found" - fi - if [[ $COUNTLIMIT -eq 2 ]] - then - # command-line printed on stdout for debug - echo -e "$INFO command: $CMDLINE $FLAGS -i $HOSTFILE $LIMIT $SOURCES/site.yml" - fi - if ( $CMDLINE $FLAGS -i $HOSTFILE $LIMIT $SOURCES/site.yml ) - then - REPLAY=false - else - # no infinite loop - COUNT=$((COUNT + 1)) - fi -done - -popd >/dev/null - -echo -e "$OK End of Replay" -echo -e "$INFO Replay launched $COUNT times" -echo -e "$OK Have a nice day $USER !" |