Skip to content

Instantly share code, notes, and snippets.

@marktheunissen
Last active June 9, 2017 00:10
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save marktheunissen/4725400 to your computer and use it in GitHub Desktop.
Save marktheunissen/4725400 to your computer and use it in GitHub Desktop.
Running Ansible on a Vagrant machine without a plugin
#!/bin/bash
echo ''
echo '======================================================================='
echo 'Setting up Ansible...'
if [ `which ansible` ]; then
echo 'Ansible already installed.'
exit;
fi
aptitude -q=2 update
aptitude -q=2 -y install build-essential git python-dev python-jinja2 python-yaml python-paramiko python-software-properties python-pip debhelper python-support cdbs
git clone https://github.com/ansible/ansible.git /tmp/ansible
cd /tmp/ansible
git checkout v0.9 2>&1
make deb 2>&1
cd /tmp
dpkg -i ansible_0.9_all.deb
echo "localhost" > /etc/ansible/hosts
#!/bin/bash
echo ''
echo '======================================================================='
echo 'Running controller setup...'
cd $DIR
ansible-playbook --sudo -c local setup.yml
Vagrant::Config.run do |config|
config.vm.define :default do |tw_config|
tw_config.vm.box = "precise64"
tw_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
tw_config.vm.provision :shell, :path => "provision/ansible-setup.sh"
tw_config.vm.provision :shell, :path => "provision/controller-setup.sh"
# Load a local setup file if it exists, so you can use it to
# provide additional provisioning steps.
if File.exist?(File.join(File.dirname(__FILE__), "setup.local.sh"))
tw_config.vm.provision :shell, :path => "setup.local.sh"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment