Skip to content

Instantly share code, notes, and snippets.

@torumakabe
Last active August 29, 2015 14:06
Show Gist options
  • Save torumakabe/57ae9f8edbe6cf30cd16 to your computer and use it in GitHub Desktop.
Save torumakabe/57ae9f8edbe6cf30cd16 to your computer and use it in GitHub Desktop.
shell for a host of OpenStack tools
#!/bin/sh
ANSIBLE_PLAYBOOK=$1
ANSIBLE_HOSTS=$2
TEMP_HOSTS="/tmp/ansible_hosts"
if ! [ `which ansible` ]; then
apt-get install -y software-properties-common
apt-add-repository -y ppa:ansible/ansible
apt-get update
apt-get -y install ansible
fi
cp /vagrant/${ANSIBLE_HOSTS} ${TEMP_HOSTS} && chmod -x ${TEMP_HOSTS}
echo "Executing ansible ..."
bash -c "ansible-playbook /vagrant/${ANSIBLE_PLAYBOOK} --inventory-file=${TEMP_HOSTS} --connection=local"
rm ${TEMP_HOSTS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment