2023-12-29 21:03:58 +01:00
|
|
|
# included file
|
|
|
|
|
|
|
|
# -o/--one-line
|
|
|
|
# debug can be split into controller/client
|
2023-12-30 12:08:18 +01:00
|
|
|
# [--debug port|-port|debug|ansible]
|
|
|
|
USAGE="USAGE: $0 [--verbose 0-3] [--check] [--diff] [--step] [--skip comma,separated] [--tags comma,separated] [ -l limit ] [ -c connection ] roles..."
|
2023-12-29 21:03:58 +01:00
|
|
|
skip=
|
|
|
|
tags='untagged'
|
|
|
|
check=0
|
|
|
|
connection='local'
|
|
|
|
verbose=1
|
2023-12-30 12:08:18 +01:00
|
|
|
# debug=
|
2023-12-29 21:03:58 +01:00
|
|
|
diff=0
|
|
|
|
become=-1
|
|
|
|
limit=''
|
|
|
|
inventory=hosts.yml
|
|
|
|
step=0
|
|
|
|
timeout=60
|
|
|
|
gather_timeout=120
|
|
|
|
start=""
|
|
|
|
list_tags=0
|
|
|
|
list_tasks=0
|
|
|
|
# unused
|
|
|
|
user=""
|
|
|
|
group=""
|
|
|
|
home=""
|
|
|
|
also=""
|
|
|
|
|
|
|
|
# from inventory
|
|
|
|
|
|
|
|
TEMP=$(getopt -o 'HCRDSGTbs:t:u:v:g:h:a:l:c:i:' --long 'help,check,debug,diff,step,listtags,listtasks,become,start:,skip:,tags:,user:,verbose:,group:,home:,also:,limit:,connection:,inventory:' -n $0 -- "$@" )
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo $USAGE >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Note the quotes around "$TEMP": they are essential!
|
|
|
|
eval set -- "$TEMP"
|
|
|
|
unset TEMP
|
|
|
|
# echo DEBUG: $*
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
'-H'|'--help')
|
|
|
|
echo $USAGE
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
'-C'|'--check')
|
|
|
|
check=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-R'|'--debug')
|
|
|
|
shift
|
|
|
|
debug=$1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-D'|'--diff')
|
|
|
|
diff=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-S'|'--step')
|
|
|
|
step=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-G'|'--listtags')
|
|
|
|
list_tasks=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-L'|'--listtasks')
|
|
|
|
list_tasks=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-b'|'--become')
|
|
|
|
become=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-T'|'--start')
|
|
|
|
start=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-s'|'--skip')
|
|
|
|
skip=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-t'|'--tags')
|
|
|
|
tags=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-u'|'--user')
|
|
|
|
user=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-v'|'--verbose')
|
|
|
|
verbose=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-g'|'--group')
|
|
|
|
group=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-h'|'--home')
|
|
|
|
home=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-a'|'--also')
|
|
|
|
also=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-l'|'--limit')
|
|
|
|
limit=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-c'|'--connection')
|
|
|
|
connection=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'-i'|'--inventory')
|
|
|
|
inventory=$2
|
|
|
|
shift 2
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
'--')
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ERROR 'Internal error! unprocessed --' $* >&2
|
|
|
|
exit 2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
# echo DEBUG: ROLES $*
|
|
|
|
roles="$*"
|
|
|
|
|
|
|
|
RUN_QERC_USERFILE="$HOME/QeRcUser.yaml"
|
|
|
|
|
|
|
|
[ -z "$limit" ] && BOX_HOST=localhost || BOX_HOST=$limit
|
|
|
|
limit=$BOX_HOST
|
|
|
|
|
|
|
|
# --flush-cache
|
|
|
|
if [ $verbose -eq 1 ] ; then
|
|
|
|
LARGS="-v"
|
|
|
|
elif [ $verbose -eq 2 ] ; then
|
|
|
|
LARGS="-vv"
|
|
|
|
elif [ $verbose -eq 3 ] ; then
|
|
|
|
LARGS="-vvv"
|
|
|
|
elif [ $verbose -eq 4 ] ; then
|
|
|
|
LARGS="-vvvv"
|
|
|
|
else
|
|
|
|
LARGS=""
|
|
|
|
fi
|