mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
runrole --reinstall to remove role installed marker
This commit is contained in:
parent
4d4c428667
commit
13206f4265
1 changed files with 22 additions and 14 deletions
36
runrole
36
runrole
|
@ -4,8 +4,28 @@ INVENTORY="ansible_hosts"
|
|||
PLAYBOOK="run-one-role.yml"
|
||||
ARGS=""
|
||||
CWD=`pwd`
|
||||
if [ ! -f $PLAYBOOK ]; then
|
||||
echo "Exiting: IIAB Playbook not found."
|
||||
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
echo " usage: ./runrole <name of role>"
|
||||
echo " usage: ./runrole --reinstall <name of role>"
|
||||
echo " Last variable would be full path to log file."
|
||||
echo " If ommited current directory is used."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "--reinstall" ]; then
|
||||
ARGS="$ARGS --extra-vars reinstall=True"
|
||||
if [ ! $2 == "internetarchive" ]; then # special handling
|
||||
if [ $2 == "calibre-web" ]; then # role directory & installed marker differ
|
||||
sed -i -e '/^calibreweb/d' /etc/iiab/config_vars2.yml
|
||||
fi
|
||||
sed -i -e "/^$2/d" /etc/iiab/config_vars2.yml
|
||||
fi
|
||||
shift 1
|
||||
fi
|
||||
|
||||
|
@ -15,22 +35,10 @@ else
|
|||
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
|
||||
fi
|
||||
|
||||
if [ ! -f $PLAYBOOK ]; then
|
||||
echo "Exiting: IIAB Playbook not found."
|
||||
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Is the following stanza nec?
|
||||
if [ ! -f /etc/iiab/config_vars.yml ]; then
|
||||
if [ ! -f /etc/iiab/config_vars2.yml ]; then
|
||||
mkdir -p /etc/iiab
|
||||
echo "{}" > /etc/iiab/config_vars.yml
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
echo " usage: ./runrole <name of role>"
|
||||
echo " Can only take a single value."
|
||||
exit 0
|
||||
echo "{}" > /etc/iiab/config_vars2.yml
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue