mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
runrole - ensure local_vars has *_install is set to True
This commit is contained in:
parent
2423d9a293
commit
2519c74887
1 changed files with 47 additions and 14 deletions
61
runrole
61
runrole
|
@ -3,8 +3,11 @@
|
||||||
INVENTORY="ansible_hosts"
|
INVENTORY="ansible_hosts"
|
||||||
PLAYBOOK="run-one-role.yml"
|
PLAYBOOK="run-one-role.yml"
|
||||||
ARGS=""
|
ARGS=""
|
||||||
|
REINSTALL=0
|
||||||
CWD=`pwd`
|
CWD=`pwd`
|
||||||
APPS=/etc/iiab/config_vars2.yml
|
APPS=/etc/iiab/config_vars2.yml
|
||||||
|
VARS=/etc/iiab/local_vars.yml
|
||||||
|
|
||||||
if [ ! -f $PLAYBOOK ]; then
|
if [ ! -f $PLAYBOOK ]; then
|
||||||
echo "Exiting: IIAB Playbook not found."
|
echo "Exiting: IIAB Playbook not found."
|
||||||
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
|
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
|
||||||
|
@ -19,27 +22,57 @@ if [[ $# -eq 0 ]] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
clear_marker(){
|
||||||
|
if [ ! $1 == "internetarchive" ]; then # special handling
|
||||||
|
if [ $1 == "calibre-web" ]; then # role directory & installed marker differ
|
||||||
|
sed -i -e '/^calibreweb/d' $APPS
|
||||||
|
|
||||||
|
elif [ $1 == "captive-portal" ]; then # role directory & installed marker differ
|
||||||
|
sed -i -e '/^captiveportal/d' $APPS
|
||||||
|
|
||||||
|
elif [ $1 == "bluetooth" ]; then # role directory & installed marker differ
|
||||||
|
sed -i -e '/^pan_bluetooth/d' $APPS
|
||||||
|
fi
|
||||||
|
sed -i -e "/^$1/d" $APPS
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$1" == "--reinstall" ]; then
|
||||||
|
ARGS="$ARGS --extra-vars reinstall=True"
|
||||||
|
REINSTALL=1
|
||||||
|
shift 1
|
||||||
|
fi
|
||||||
|
|
||||||
# needed for stage 1-3 if not installed yet
|
# needed for stage 1-3 if not installed yet
|
||||||
if [ ! -f $APPS ]; then
|
if [ ! -f $APPS ]; then
|
||||||
mkdir -p /etc/iiab
|
mkdir -p /etc/iiab
|
||||||
touch $APPS
|
touch $APPS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "--reinstall" ]; then
|
if ! grep -q $1_install $VARS; then
|
||||||
ARGS="$ARGS --extra-vars reinstall=True"
|
echo " $1_install: not found in $VARS"
|
||||||
if [ ! $2 == "internetarchive" ]; then # special handling
|
echo " Please review $VARS and edit as required"
|
||||||
if [ $2 == "calibre-web" ]; then # role directory & installed marker differ
|
exit 1
|
||||||
sed -i -e '/^calibreweb/d' $APPS
|
elif grep $1_install $VARS | grep -q --exclude "#" False; then
|
||||||
|
echo " $1_install: set to False found in $VARS"
|
||||||
|
echo " Please review $VARS and edit as required"
|
||||||
|
exit 1
|
||||||
|
elif grep $1_install $VARS | grep -q "#"; then
|
||||||
|
echo " $1_install: commented out (#) in $VARS"
|
||||||
|
echo " Please review $VARS and edit as required"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
if grep $1_install $VARS | grep -q --exclude "#" True; then
|
||||||
|
echo " $1_install: set to True found in $VARS"
|
||||||
|
echo " continuing...."
|
||||||
|
else
|
||||||
|
echo "somthing went wrong to get here"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ $2 == "captive-portal" ]; then # role directory & installed marker differ
|
fi
|
||||||
sed -i -e '/^captiveportal/d' $APPS
|
|
||||||
fi
|
if [ "$REINSTALL" == "1" ]; then
|
||||||
if [ $2 == "bluetooth" ]; then # role directory & installed marker differ
|
clear_marker
|
||||||
sed -i -e '/^pan_bluetooth/d' $APPS
|
|
||||||
fi
|
|
||||||
sed -i -e "/^$2/d" $APPS
|
|
||||||
fi
|
|
||||||
shift 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue