1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 19:22:24 +00:00
iiab/runtags.deprecated

48 lines
1.1 KiB
Text
Raw Normal View History

2017-05-27 18:09:50 +00:00
#!/bin/bash
2018-03-28 18:01:59 +00:00
2017-10-24 16:39:49 +00:00
INVENTORY="ansible_hosts"
2018-03-28 18:01:59 +00:00
PLAYBOOK="iiab.yml"
#PLAYBOOK="iiab-stages.yml"
2017-10-24 16:39:49 +00:00
CWD=`pwd`
2017-10-30 17:57:55 +00:00
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
2018-03-28 18:01:59 +00:00
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
2017-05-27 18:09:50 +00:00
fi
2018-03-28 18:01:59 +00:00
# Is the following stanza nec?
if [ ! -f /etc/iiab/config_vars.yml ]; then
mkdir -p /etc/iiab
echo "{}" > /etc/iiab/config_vars.yml
fi
2017-05-27 18:09:50 +00:00
tags=$(echo $1 | tr "," "\n")
2018-03-28 18:01:59 +00:00
if [ "$tags" == "" ]; then
echo " usage: ./runtags <tagname>"
echo " usage: ./runtags <tagname1>,<tagname2>,<tagname3>"
echo " Can take a single value or a comma-separated list (no spaces within the list!)"
echo " Now retrieving a list of possible Ansible playbook and tagname values..."
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local --list-tags
exit 0
2017-09-16 13:11:34 +00:00
fi
2017-05-27 18:09:50 +00:00
found="N"
2018-03-28 18:01:59 +00:00
for tag in $tags; do
if [ "$tag" == "0-init" ]; then
found="Y"
fi
2017-05-27 18:09:50 +00:00
done
taglist=$1
2018-03-28 18:01:59 +00:00
if [ "$found" == "N" ]; then
taglist="0-init,"$taglist
2017-05-27 18:09:50 +00:00
fi
2018-03-28 18:01:59 +00:00
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local --tags=$taglist