1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

update scripts a bit

This commit is contained in:
Jerry Vonau 2017-10-28 11:34:40 -05:00
parent 9e0848e82f
commit ddf8f80e11
4 changed files with 26 additions and 61 deletions

View file

@ -1,15 +1,8 @@
#!/bin/bash #!/bin/bash
# running from a git repo
if [ -f /etc/iiab/iiab.env ] # ansible files exist
then
. /etc/iiab/iiab.env
cd $IIAB_DIR
else
echo /etc/iiab/iiab.env is missing. Playbook has not been run.
exit 1
fi
CWD=`pwd` CWD=`pwd`
export ANSIBLE_LOG_PATH="$CWD/iiab-network.log"
if [ ! -f iiab-network.yml ] if [ ! -f iiab-network.yml ]
then then
@ -24,7 +17,6 @@ then
touch /etc/iiab/config_vars.yml touch /etc/iiab/config_vars.yml
fi fi
export ANSIBLE_LOG_PATH="$CWD/iiab-network.log"
ansible-playbook -i ansible_hosts iiab-network.yml --connection=local ansible-playbook -i ansible_hosts iiab-network.yml --connection=local
echo "" >> iiab-network.log echo "" >> iiab-network.log
ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log

View file

@ -4,6 +4,8 @@ PLAYBOOK="iiab-base.yml"
INVENTORY="ansible_hosts" INVENTORY="ansible_hosts"
CWD=`pwd` CWD=`pwd`
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
if [ ! -f $PLAYBOOK ] if [ ! -f $PLAYBOOK ]
then then
echo "IIAB Playbook not found." echo "IIAB Playbook not found."
@ -15,5 +17,4 @@ fi
sed -i -e "s/openvpn_install: False/openvpn_install: True/" vars/local_vars.yml sed -i -e "s/openvpn_install: False/openvpn_install: True/" vars/local_vars.yml
sed -i -e "s/openvpn_enabled: False/openvpn_enabled: True/" vars/local_vars.yml sed -i -e "s/openvpn_enabled: False/openvpn_enabled: True/" vars/local_vars.yml
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local

View file

@ -1,9 +1,26 @@
#!/bin/bash -e #!/bin/bash -e
PLAYBOOK="iiab.yml" # running from a git repo
PLAYBOOK="iiab-steps.yml"
INVENTORY="ansible_hosts" INVENTORY="ansible_hosts"
CWD=`pwd`
# Pass cmdline options for ansible # Pass cmdline options for ansible
ARGS="$@" ARGS="$@"
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
if [ ! -f /etc/ansible/facts.d/local_facts.fact ]; then
mkdir -p /etc/ansible/facts.d
fi
cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact
if [ ! -f $PLAYBOOK ]
then
echo "IIAB Playbook not found."
echo "Please run this command from the top level of the git repo."
echo "Exiting."
exit 1
fi
# if vars/local_vars.yml is missing, put a default one in place - First Run # if vars/local_vars.yml is missing, put a default one in place - First Run
if [ ! -f ./vars/local_vars.yml ]; then if [ ! -f ./vars/local_vars.yml ]; then
OS=`grep ^ID= /etc/*release|cut -d= -f2` OS=`grep ^ID= /etc/*release|cut -d= -f2`
@ -23,43 +40,6 @@ if [ ! -f ./vars/local_vars.yml ]; then
esac esac
fi fi
# copy var files to /etc/iiab for subsequent use
# If iiab.env exists, on second or upgrade run, check for stale variables
# iiab.env gets created at the end of stage-4 on First Run
if [ -f /etc/iiab/iiab.env ]
then
OLD=`grep XSCE /etc/iiab/iiab.env`
if [ x"$OLD" != "x" ]
then
rm /etc/iiab/iiab.env
else
. /etc/iiab/iiab.env
cd $IIAB_DIR
fi
else
mkdir -p /etc/iiab
echo "{}" > /etc/iiab/config_vars.yml
fi
CWD=`pwd`
if [ ! -f $PLAYBOOK ]
then
echo "IIAB Playbook not found."
echo "Please run this command from the top level of the git repo."
echo "Exiting."
exit 1
fi
if [ ! -f /etc/ansible/facts.d/local_facts.fact ]; then
mkdir -p /etc/ansible/facts.d
fi
cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact
echo "Running local playbooks! " echo "Running local playbooks! "
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local

14
runtags
View file

@ -1,16 +1,11 @@
#!/bin/bash #!/bin/bash
# running from a git repo
PLAYBOOK="iiab.yml" PLAYBOOK="iiab.yml"
INVENTORY="ansible_hosts" INVENTORY="ansible_hosts"
# Pass cmdline options for ansible
if [ -f /etc/iiab/iiab.env ]
then
. /etc/iiab/iiab.env
cd $IIAB_DIR
fi
CWD=`pwd` CWD=`pwd`
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
if [ ! -f $PLAYBOOK ] if [ ! -f $PLAYBOOK ]
then then
echo "IIAB Playbook not found." echo "IIAB Playbook not found."
@ -41,8 +36,6 @@ do
fi fi
done done
# echo $found
taglist=$1 taglist=$1
if [ "$found" == "N" ] if [ "$found" == "N" ]
@ -50,5 +43,4 @@ then
taglist="0-init,"$taglist taglist="0-init,"$taglist
fi fi
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
ansible-playbook -i ansible_hosts iiab.yml --connection=local --tags="""$taglist""" ansible-playbook -i ansible_hosts iiab.yml --connection=local --tags="""$taglist"""