Created
September 1, 2014 09:00
-
-
Save taktos/f756666f285fcf91814e to your computer and use it in GitHub Desktop.
Vagrantfile for CentOS 5.10 + Ansible
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
$script = <<SCRIPT | |
if ! [ `which ansible` ]; then | |
rpm --import http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/RPM-GPG-KEY-EPEL-5 | |
wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm -O /tmp/epel-release-5-4.noarch.rpm | |
yum install -y /tmp/epel-release-5-4.noarch.rpm | |
yum install -y git | |
yum install -y python26 python26-PyYAML python26-paramiko python26-jinja2 python-simplejson rpm-build sshpass | |
git clone https://github.com/ansible/ansible.git /tmp/ansible | |
sed -i -e "s/^PYTHON=python/PYTHON=python26/g" /tmp/ansible/Makefile | |
cd /tmp/ansible | |
make rpm | |
rpm -Uvh /tmp/ansible/rpm-build/ansible-*.noarch.rpm | |
fi | |
ansible-playbook -i /vagrant/ansible/hosts /vagrant/ansible/playbook.yml | |
SCRIPT | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "opscode-centos-5.10-i386" | |
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10-i386_chef-provisionerless.box" | |
config.vm.hostname = "centos-ansible" | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "2048"] | |
vb.customize ["modifyvm", :id, "--cpus", "2"] | |
end | |
config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=775', 'fmode=664'] | |
config.vm.provision "shell", inline: $script | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment