Last active
June 9, 2017 00:10
-
-
Save marktheunissen/4725400 to your computer and use it in GitHub Desktop.
Running Ansible on a Vagrant machine without a plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '' | |
echo '=======================================================================' | |
echo 'Running controller setup...' | |
cd $DIR | |
ansible-playbook --sudo -c local setup.yml | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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