
Rather than relying on system-wide packages, just create the virtualenv and leverage the already available requirements.txt, which installs ansible along with other dependencies. Also pull the openstack inventory in the local inventory folder as ansible pip package does not bundle the inventory utility. Change-Id: I43b1c3fce522657854cdc20c55bd32366179b4b7
22 lines
551 B
Bash
Executable File
22 lines
551 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Install virtualenv package if not installed
|
|
if [ ! -f /usr/bin/pip ]; then
|
|
sudo -E apt-get install python-pip
|
|
fi
|
|
|
|
# Create infra-ansible virtual environment
|
|
pip install virtualenv
|
|
virtualenv venv
|
|
source venv/bin/activate
|
|
pip install -r requirements.txt
|
|
|
|
# Create inventory folder
|
|
if [ ! -d inventory ]; then
|
|
mkdir inventory
|
|
fi
|
|
|
|
# Install Ansible openstack inventory
|
|
/usr/bin/wget -N https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/openstack.py -O inventory/openstack.py
|
|
chmod +x inventory/openstack.py
|