Created
August 22, 2014 07:51
-
-
Save rajeshtaneja/522ff93cc01dd7bb375c to your computer and use it in GitHub Desktop.
vagrant moodle
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
domain = 'moodle.local' | |
nodes = [ | |
{ :hostname => 'apache01', :ip => '192.168.100.191', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box'}, | |
{ :hostname => 'apache02', :ip => '192.168.100.192', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box'}, | |
{ :hostname => 'apache03', :ip => '192.168.100.193', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box', :ram => '2048'}, | |
{ :hostname => 'apache04', :ip => '192.168.100.194', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box', :ram => '2048'}, | |
] | |
VAGRANTFILE_API_VERSION = "2" | |
$puppetinstallscript = <<SCRIPT | |
echo I am provisioning puppet agent... | |
wget -O /root/puppet.deb http://apt.puppetlabs.com/puppetlabs-release-trusty.deb | |
dpkg -i /root/puppet.deb | |
apt-get update | |
apt-get -y install puppet | |
puppet agent --enable | |
puppet agent -t --server=rajesh.moodle.local | |
echo Puppet provisioning done... | |
SCRIPT | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# Ubuntu Vm's which are listed above. | |
nodes.each do |node| | |
config.vm.define node[:hostname] do |node_config| | |
node_config.vm.box = node[:box] | |
node_config.vm.host_name = node[:hostname] + '.' + domain | |
node_config.vm.network "public_network",bridge: 'br0',ip: node[:ip] | |
memory = node[:ram] ? node[:ram] : 512; | |
node_config.vm.provider :virtualbox do |vb| | |
# Use VBoxManage to customize the VM | |
vb.customize ["modifyvm", :id, | |
"--name", node[:hostname], | |
"--memory", memory.to_s, | |
] | |
# vb.gui = true | |
end | |
node_config.vm.synced_folder "/srv/shared/", "/shared" | |
end | |
config.vm.provision "shell", inline: $puppetinstallscript | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment