Build: tweak prometheus requires line, add changelog bits
[pcp.git] / Vagrantfile
blob60ed6eb860cba1048ba6a98da1aa3470b5fd999a
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
4 # Leave this alone
5 VAGRANTFILE_API_VERSION = "2"
7 # VM Configs
8 VM_MEM = "1024"
9 VM_CPU = "1"
11 # QA Flags
12 QA_FLAGS = ""
13 #QA_FLAGS = "022"
14 #QA_FLAGS = "-g pmda.linux"
18 ############################################################
19 # Host Definititions
20 ############################################################
22 pcp_hosts = {
23         :ubuntu1204 => {
24                 :hostname => "ubuntu1204",
25                 :ipaddress => "10.100.10.10",
26                 :box => "ubuntu/precise64",
27                 :script => "ubuntu.sh"
28         },
29 #        :ubuntu1304 => {
30 #                :hostname => "ubuntu1304",
31 #                :ipaddress => "10.100.10.11",
32 #                :box => "chef/ubuntu-13.04",
33 #                :script => "#{$script_EOLubuntu}"
34 #        },
35         :ubuntu1404 => {
36                 :hostname => "ubuntu1404",
37                 :ipaddress => "10.100.10.12",
38                 :box => "ubuntu/trusty64",
39                 :script => "ubuntu.sh"
40         },
41 #       :centos511 => {
42 #                :hostname => "centos511",
43 #                :ipaddress => "10.100.10.20",
44 #                :box => "chef/centos-5.11",
45 #                :script => "centos.sh"
46 #        },
47 #        :centos511_32 => {
48 #                :hostname => "centos511-32",
49 #                :ipaddress => "10.100.10.21",
50 #                :box => "chef/centos-5.11-i386",
51 #                :script => "centos.sh"
52 #        },
53 #        :centos65 => {
54 #               :hostname => "centos65",
55 #                :ipaddress => "10.100.10.22",
56 #                :box => "chef/centos-6.5",
57 #                :script => "centos.sh"
58 #        },
59         :centos7 => {
60                 :hostname => "centos7",
61                 :ipaddress => "10.100.10.23",
62                 :box => "centos/7",
63                 :script => "centos.sh"
64         },
65         :fedora23 => {
66                 :hostname => "fedora23",
67                 :ipaddress => "10.100.10.30",
68                 :box => "fedora/23-cloud-base",
69                 :script => "fedora.sh"
70         },
71         :debian76 => {
72                 :hostname => "debianwheezy",
73                 :ipaddress => "10.100.10.40",
74                 :box => "debian/wheezy64",
75                 :script => "debian.sh"
76         },
77         :debian8 => {
78                 :hostname => "debianjessie",
79                 :ipaddress => "10.100.10.40",
80                 :box => "debian/jessie64",
81                 :script => "debian.sh"
82         }
83 # Built locally from : https://github.com/opscode/bento
84 # NAT comes up but not the host interface
85 #        :opensuse132 => {
86 #                :hostname => "opensuse132",
87 #                :ipaddress => "10.100.10.51",
88 #                :box => "minnus-opensuse-13.2",
89 #                :script => "suse.sh"
90 #        }
91 # Networking wont come up
92 #        :opensuse131 => {
93 #                :hostname => "opensuse131",
94 #                :ipaddress => "10.100.10.50",
95 #                :box => "chef/opensuse-13.1",
96 #                :script => "suse.sh"
97 #        }
98 # Possible opensuse box?
99 #        :opensuseleap42 => {
100 #                :hostname => "opensuse42",
101 #                :ipaddress => "10.100.10.52",
102 #                :box => "opensuse/openSUSE-42.1-x86_64",
103 #                :script => "suse.sh"
104 #        }
108 EXPECTED_PLATFORM="darwin"
109 EXPECTED_ACK_FILE="provisioning/osxsierra.legally.ok"
110 platform_ok_to_use_OSX=RUBY_PLATFORM.include?(EXPECTED_PLATFORM)
111 eula_acknowledged = File.exists?(EXPECTED_ACK_FILE)
112 ok_to_use_OSX = platform_ok_to_use_OSX && eula_acknowledged
114 ############################################################
115 # Only allowed to use oxssierra image if the underlying platform
116 # is a Mac and that the user has checked
118 # see OSXREADME.md for more details
119 ############################################################
120 if(ok_to_use_OSX)
121         pcp_hosts[:osxsierra]={
122                                         :hostname => "osxSierra",
123                                         :ipaddress => "10.100.10.60",
124                                         # https://github.com/AndrewDryga/vagrant-box-osx
125                                         # TODO - this base image takes flipping ages to provision
126                                         # due to PCP dependencies that need to be built by
127                                         # Homebrew (eg. qt5, gettext)
128                                         # it would be better to have a base image based off this
129                                         # box that has these pre-installed
130                                         :box => "http://files.dryga.com/boxes/osx-sierra-0.3.1.box",
131                                         :script => "osxsierra.sh"
132         }
135 ############################################################
136 # Common Config Setup, hostnames, etc
137 # So VMs could talk to each other if we wanted
138 ############################################################
140 $script_common = ""
142 # We set our own IP
143 $script_common << "sed -i '/127.0.1.1/d' /etc/hosts\n"
144 # Fix bogus entries that some os use
145 $script_common << "sed -i '/127.0.0.1/d' /etc/hosts\n"
146 $script_common << "echo \"127.0.0.1 localhost.localdomain localhost\" >> /etc/hosts\n"
148 pcp_hosts.each_pair do |name, options|
149         ipaddr = options[:ipaddress]
150         hostname = options[:hostname]
151         $script_common << "echo \"#{ipaddr} #{hostname} #{hostname}.localdomain\" >> /etc/hosts\n"
154 $script_common << "domainname localdomain"
156 ############################################################
157 # Main Vagrant Init : Loop over Host configs
158 ############################################################
160 Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
162   global_config.ssh.forward_x11 = true
163   global_config.ssh.forward_agent = true
164   global_config.ssh.insert_key = false
167   if Vagrant.has_plugin?("vagrant-cachier")
168     global_config.cache.scope = :box
169   end
171   # Global shared folder for pcp source.  Copy it so we have our own to muck around in
172   global_config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync_auto: false, :rsync__exclude => ["qaresults/", "pcp-*"]
174   pcp_hosts.each_pair do |name, options|
175     global_config.vm.define name do |config|
177        config.vm.provider "virtualbox" do |v|
178           v.name = "Vagrant PCP - #{name}"
179           v.customize ["modifyvm", :id, "--groups", "/VagrantPCP", "--memory", VM_MEM, "--cpus", VM_CPU]
180        end
182        config.vm.box = options[:box]
184        # VM specific shared folder for qa results
185        # config.vm.synced_folder "./qaresults/#{name}", "/qaresults", mount_options: ["dmode=777", "fmode=666"], create: true
187        # TODO - this appears to fail with `vagrant provision osxsierra`
188        config.vm.synced_folder "./qaresults/#{name}", "/qaresults", create: true
190        config.vm.hostname = "#{options[:hostname]}"
191        config.vm.network :private_network, ip: options[:ipaddress]
193        # Setup networking etc
194        config.vm.provision :shell, :inline => $script_common
196        # Do platfrom specifics: install packages, etc
197        config.vm.provision :shell, path: "provisioning/#{options[:script]}"
199        # Run QA and copy results back to host
200        config.vm.provision :shell, :path => "provisioning/qa.sh"
201     end
202   end