Script improvements for greater compatability/testing
Changed the scripts to support yum as well as apt, and added a step to execute the ansible check-syntax sequence in order to fail fast in the event of a syntax issue. Additionally, the installation of jinja2 has been switched to use a requirements.txt file placed in the root of the repository.
This commit is contained in:
parent
7f444f6503
commit
cd48a75419
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
jinja2
|
@ -1,7 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
sudo -H apt-get -y install git python-pip
|
||||
sudo -H pip install jinja2
|
||||
if [ -x '/usr/bin/apt-get' ]; then
|
||||
if ! $(git --version &>/dev/null) ; then
|
||||
sudo -H apt-get -y install git
|
||||
fi
|
||||
if ! $(pip -v &>/dev/null); then
|
||||
sudo -H apt-get -y install python-pip
|
||||
fi
|
||||
elif [ -x '/usr/bin/yum' ]; then
|
||||
if ! $(git --version &>/dev/null); then
|
||||
sudo -H yum -y install git
|
||||
fi
|
||||
if ! $(pip -v &>/dev/null); then
|
||||
sudo -H yum -y install python-pip
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Supported package manager not found. Supported: apt,yum"
|
||||
fi
|
||||
|
||||
sudo -E pip install -r "$(dirname $0)/../requirements.txt"
|
||||
|
||||
u=$(whoami)
|
||||
g=$(groups | awk '{print $1}')
|
||||
@ -24,7 +42,8 @@ else
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Run the following commands to proceed: "
|
||||
echo "If your using this script directly, execute the"
|
||||
echo "following commands to update your shell."
|
||||
echo
|
||||
echo "source env-vars"
|
||||
echo "source /opt/stack/ansible/hacking/env-setup"
|
||||
|
@ -13,5 +13,8 @@ source /opt/stack/ansible/hacking/env-setup
|
||||
# Change working directory
|
||||
cd $BIFROST_HOME/playbooks
|
||||
|
||||
# Perform a syntax check
|
||||
ansible-playbook -vvvv -i inventory/localhost test-bifrost.yaml --syntax-check --list-tasks
|
||||
|
||||
# Execute test playbook
|
||||
ansible-playbook -vvvv -i inventory/localhost test-bifrost.yaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user