infra-ansible/setup_env.sh
Ricardo Carrillo Cruz efd0234300 Switch the provisioning step to the cloud launcher role
I've been slowly decoupling the provisioning role from infra-ansible
into its own role:

http://git.openstack.org/cgit/openstack/ansible-role-cloud-launcher

Now that it has feature parity and it is gating in OpenStack CI,
just use it and remove setup_openstack_resources roles.

Change-Id: I4810d0bdb57cf1f069f20fb133f5f2afe15e4e87
2016-06-07 13:35:47 +00:00

49 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
#
# Install python pip & virtualenv packages & then create
# a python virtualenv & install the infra-ansible dependencies in it
# check platform prerequisites
case $(uname) in
Linux)
# check if the apt-get executable is available
if hash apt-get 2>/dev/null; then
# check for & install the various packages
hash pip 2>/dev/null || { sudo -E apt-get install -y python-pip; }
[[ -z "$(dpkg -l python-dev | grep '^ii python-dev')" ]] && sudo -E apt-get install -y python-dev
hash virtualenv 2>/dev/null || { sudo pip install virtualenv; }
elif hash yum 2>/dev/null; then
# on RHEL/CentOS, pip is installed during the virtualenv setup
hash virtualenv 2>/dev/null || { sudo -E yum install -y python-virtualenv python-devel gcc gcc-c++; }
hash wget 2>/dev/null || { sudo -E yum install -y wget; }
else
echo "ERROR: Zoinks, I only know about Debian and RHEL"
exit 1
fi
;;
Darwin)
hash pip 2>/dev/null || { echo "ERROR: pip isn't installed, please rectify this!" ; exit 1; }
hash virtualenv 2>/dev/null || { sudo pip install virtualenv; }
;;
esac
# Create a fresh infra-ansible virtual environment
[[ -e venv ]] && rm -rf venv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
# Create inventory folder
if [[ ! -d inventory ]]; then
mkdir inventory
fi
# Install roles dependencies from requirements.yml
ansible-galaxy install -r requirements.yml
# Install Ansible openstack inventory
wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/openstack.py -O inventory/openstack.py
chmod +x inventory/openstack.py