OLD | NEW |
1 VAGRANTFILE_API_VERSION = "2" | 1 VAGRANTFILE_API_VERSION = "2" |
| 2 require 'yaml' |
2 | 3 |
3 def define_standard_vm(config, host_name, ip) | 4 def define_standard_vm(config, host_name, ip) |
4 config.vm.define host_name do |config| | 5 config.vm.define host_name do |config| |
| 6 |
5 config.vm.box = 'precise64' | 7 config.vm.box = 'precise64' |
6 config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/precise/current/
precise-server-cloudimg-amd64-vagrant-disk1.box' | 8 config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/precise/current/
precise-server-cloudimg-amd64-vagrant-disk1.box' |
7 config.vm.host_name = "#{host_name}.adblockplus.org" | 9 config.vm.host_name = "#{host_name}.adblockplus.org" |
8 config.vm.network :private_network, ip: ip | 10 config.vm.network :private_network, ip: ip |
9 config.vm.provider :virtualbox do |vb| | 11 config.vm.provider :virtualbox do |vb| |
10 vb.customize ["modifyvm", :id, "--cpus", 1] | 12 vb.customize ["modifyvm", :id, "--cpus", 1] |
11 | |
12 # Work around https://www.virtualbox.org/ticket/11649 | 13 # Work around https://www.virtualbox.org/ticket/11649 |
13 vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on'] | 14 vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on'] |
14 end | 15 end |
15 | 16 |
16 config.vm.provision :shell, :inline => ' | 17 config.vm.provision :shell, :path => 'hiera/files/precise.sh' |
17 if ! test -f /usr/bin/puppet; then | 18 config.vm.provision :puppet do |puppet| |
18 sudo apt-get update && sudo apt-get install -y puppet | 19 puppet.options = [ |
19 fi' | 20 '--environment=development', |
20 | 21 '--external_nodes=/usr/local/bin/puppet-node-classifier', |
21 manifest_files = ['vagrant.pp', 'nodes.pp'] | 22 '--node_terminus=exec', |
22 manifest_files.each do |manifest_file| | 23 ] |
23 config.vm.provision :puppet do |puppet| | 24 puppet.manifests_path = 'manifests' |
24 puppet.options = ['--environment=development'] | 25 puppet.manifest_file = 'nodes.pp' |
25 puppet.manifests_path = 'manifests' | 26 puppet.module_path = 'modules' |
26 puppet.manifest_file = manifest_file | 27 # Requires Puppet 3.x or later |
27 puppet.module_path = 'modules' | 28 #puppet.hiera_config_path = 'hiera/vagrant.yaml' |
28 end | |
29 end | 29 end |
30 | 30 |
31 yield(config) if block_given? | 31 yield(config) if block_given? |
| 32 |
32 end | 33 end |
33 end | 34 end |
34 | 35 |
| 36 |
35 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | 37 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
36 define_standard_vm config, 'server4', '10.8.0.99' | 38 configYAML = File.join(Dir.pwd, "hiera/environments/development/hosts.yaml") |
37 define_standard_vm config, 'server5', '10.8.0.100' | 39 configServers = YAML.load_file(configYAML) |
38 define_standard_vm config, 'server6', '10.8.0.101' | 40 servers = configServers["servers"] |
39 define_standard_vm config, 'server7', '10.8.0.102' | 41 servers.each do |server, items| |
40 define_standard_vm config, 'server10', '10.8.0.105' do |config| | 42 define_standard_vm(config, server, items["ip"][0]) |
41 config.vm.provider :virtualbox do |vb| | |
42 vb.customize ["modifyvm", :id, "--memory", 1024] | |
43 end | |
44 end | 43 end |
45 define_standard_vm config, 'server11', '10.8.0.106' | |
46 define_standard_vm config, 'server12', '10.8.0.107' | |
47 define_standard_vm config, 'server15', '10.8.0.110' | |
48 define_standard_vm config, 'server19', '10.8.0.114' | |
49 define_standard_vm config, 'notification1', '10.8.0.118' | |
50 define_standard_vm config, 'notification2', '10.8.0.119' | |
51 define_standard_vm config, 'filter1', '10.8.0.120' | |
52 define_standard_vm config, 'filter2', '10.8.0.121' | |
53 define_standard_vm config, 'filter3', '10.8.0.122' | |
54 define_standard_vm config, 'filter4', '10.8.0.123' | |
55 define_standard_vm config, 'filter5', '10.8.0.124' | |
56 define_standard_vm config, 'filter6', '10.8.0.125' | |
57 define_standard_vm config, 'download1', '10.8.0.126' | |
58 define_standard_vm config, 'filtermaster1', '10.8.0.127' | |
59 define_standard_vm config, 'update1', '10.8.0.128' | |
60 define_standard_vm config, 'web1', '10.8.0.129' | |
61 define_standard_vm config, 'stats1', '10.8.0.130' | |
62 define_standard_vm config, 'issues1', '10.8.0.131' | |
63 define_standard_vm config, 'codereview1', '10.8.0.132' | |
64 define_standard_vm config, 'filter7', '10.8.0.133' | |
65 define_standard_vm config, 'filter8', '10.8.0.134' | |
66 define_standard_vm config, 'filter9', '10.8.0.135' | |
67 define_standard_vm config, 'filter10', '10.8.0.136' | |
68 define_standard_vm config, 'filter11', '10.8.0.137' | |
69 define_standard_vm config, 'filter12', '10.8.0.138' | |
70 define_standard_vm config, 'filter13', '10.8.0.139' | |
71 define_standard_vm config, 'filter14', '10.8.0.140' | |
72 define_standard_vm config, 'filter15', '10.8.0.141' | |
73 define_standard_vm config, 'filter16', '10.8.0.142' | |
74 define_standard_vm config, 'filter17', '10.8.0.143' | |
75 define_standard_vm config, 'filter18', '10.8.0.144' | |
76 end | 44 end |
OLD | NEW |