From f3581a6e8812444964a2781048d7c8cc03dd123e Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 3 Apr 2018 11:55:36 -0400 Subject: [PATCH] Create runrole --- runrole | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 runrole diff --git a/runrole b/runrole new file mode 100644 index 000000000..31f4aac54 --- /dev/null +++ b/runrole @@ -0,0 +1,28 @@ +#!/bin/bash + +INVENTORY="ansible_hosts" +PLAYBOOK="run-one-role.yml" +#PLAYBOOK="iiab-stages.yml" +CWD=`pwd` + +export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log" + +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 + mkdir -p /etc/iiab + echo "{}" > /etc/iiab/config_vars.yml +fi + +if [[ $# -eq 0 ]] ; then + echo " usage: ./runrole " + echo " Can only take a single value." + exit 0 +fi + +ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local -e "role_to_run=$1"