Skip to content

Instantly share code, notes, and snippets.

@tknerr
Created December 10, 2014 16:57
Show Gist options
  • Save tknerr/140fe6431953cc7dddfd to your computer and use it in GitHub Desktop.
Save tknerr/140fe6431953cc7dddfd to your computer and use it in GitHub Desktop.
Shell script for installing ansible. Should be idempotent and work ob Ubuntu + CentOS. Based on https://github.com/vovimayhem/vagrant-guest_ansible/pull/6/files#diff-0
#!/bin/bash
if ! command -v ansible >/dev/null; then
echo "Installing Ansible dependencies and Git."
if command -v yum >/dev/null; then
sudo yum install -y git python python-devel
elif command -v apt-get >/dev/null; then
sudo apt-get update -qq
#sudo apt-get install -y -qq git python-yaml python-paramiko python-jinja2
sudo apt-get install -y -qq git python python-dev
else
echo "neither yum nor apt-get found!"
exit 1
fi
echo "Installing pip via easy_install."
wget http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py && rm -f ez_setup.py
sudo easy_install pip
# Make sure setuptools are installed crrectly.
sudo pip install setuptools --no-use-wheel --upgrade
echo "Installing required python modules."
sudo pip install paramiko pyyaml jinja2 markupsafe
sudo pip install ansible
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment