|
1 # -*- mode: ruby -*- |
|
2 # vi: set ft=ruby : |
|
3 |
|
4 require 'yaml' |
|
5 |
|
6 custom_file_path = File.join(__dir__, (ENV['SYSCONFIG'] || 'custom.yaml')) |
|
7 |
|
8 context = (File.exist?(custom_file_path)?YAML::load_file(custom_file_path):{}) || {} |
|
9 |
|
10 ROOT_PATH = context.fetch("root_path","../") |
|
11 |
|
12 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! |
|
13 VAGRANTFILE_API_VERSION = "2" |
|
14 |
|
15 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
|
16 # All Vagrant configuration is done here. The most common configuration |
|
17 # options are documented and commented below. For a complete reference, |
|
18 # please see the online documentation at vagrantup.com. |
|
19 |
|
20 # Every Vagrant virtual environment requires a box to build off of. |
|
21 config.vm.box=context.fetch("vm_box","puppetlabs/ubuntu-14.04-64-puppet") |
|
22 |
|
23 # Disable automatic box update checking. If you disable this, then |
|
24 # boxes will only be checked for updates when the user runs |
|
25 # `vagrant box outdated`. This is not recommended. |
|
26 # config.vm.box_check_update = false |
|
27 |
|
28 # Create a forwarded port mapping which allows access to a specific port |
|
29 # within the machine from a port on the host machine. In the example below, |
|
30 # accessing "localhost:8080" will access port 80 on the guest machine. |
|
31 config.vm.network "forwarded_port", guest: 8000, host: 8001 |
|
32 config.vm.network "forwarded_port", guest: 5000, host: 5001 |
|
33 |
|
34 # Create a private network, which allows host-only access to the machine |
|
35 # using a specific IP. |
|
36 # config.vm.network "private_network", ip: "192.168.33.10" |
|
37 config.vm.network :private_network, ip: (ENV['VM_IP'] || context['vm_ip'] || "172.16.1.3") |
|
38 |
|
39 # Create a public network, which generally matched to bridged network. |
|
40 # Bridged networks make the machine appear as another physical device on |
|
41 # your network. |
|
42 # config.vm.network "public_network" |
|
43 |
|
44 # If true, then any SSH connections made will enable agent forwarding. |
|
45 # Default value: false |
|
46 # config.ssh.forward_agent = true |
|
47 |
|
48 # Share an additional folder to the guest VM. The first argument is |
|
49 # the path on the host to the actual folder. The second argument is |
|
50 # the path on the guest to mount the folder. And the optional third |
|
51 # argument is a set of non-required options. |
|
52 # config.vm.synced_folder "../data", "/vagrant_data" |
|
53 config.vm.synced_folder ROOT_PATH, "/srv/catedit" |
|
54 vmname = (ENV['VM_NAME'] || context['vm_name'] || "catedit_dev") |
|
55 config.vm.define :"#{vmname}" do |catedit_dev| |
|
56 end |
|
57 |
|
58 # Provider-specific configuration so you can fine-tune various |
|
59 # backing providers for Vagrant. These expose provider-specific options. |
|
60 # Example for VirtualBox: |
|
61 # |
|
62 # config.vm.provider "virtualbox" do |vb| |
|
63 # # Don't boot with headless mode |
|
64 # vb.gui = true |
|
65 # |
|
66 # # Use VBoxManage to customize the VM. For example to change memory: |
|
67 # vb.customize ["modifyvm", :id, "--memory", "1024"] |
|
68 # end |
|
69 config.vm.provider :virtualbox do |vb| |
|
70 vb.name = vmname |
|
71 end |
|
72 # |
|
73 # View the documentation for the provider you're using for more |
|
74 # information on available options. |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 # Enable provisioning with CFEngine. CFEngine Community packages are |
|
80 # automatically installed. For example, configure the host as a |
|
81 # policy server and optionally a policy file to run: |
|
82 # |
|
83 # config.vm.provision "cfengine" do |cf| |
|
84 # cf.am_policy_hub = true |
|
85 # # cf.run_file = "motd.cf" |
|
86 # end |
|
87 # |
|
88 # You can also configure and bootstrap a client to an existing |
|
89 # policy server: |
|
90 # |
|
91 # config.vm.provision "cfengine" do |cf| |
|
92 # cf.policy_server_address = "10.0.2.15" |
|
93 # end |
|
94 |
|
95 # Enable provisioning with Puppet stand alone. Puppet manifests |
|
96 # are contained in a directory path relative to this Vagrantfile. |
|
97 # You will need to create the manifests directory and a manifest in |
|
98 # the file default.pp in the manifests_path directory. |
|
99 # |
|
100 |
|
101 config.vm.provision :puppet do |puppet| |
|
102 puppet.manifests_path = "manifests" |
|
103 puppet.manifest_file = "site.pp" |
|
104 puppet.module_path = "modules" |
|
105 puppet.options = "--hiera_config /vagrant/hiera.yaml" |
|
106 puppet.facter = { |
|
107 "vagrant_base_path" => File.dirname(__FILE__) |
|
108 } |
|
109 end |
|
110 |
|
111 # Enable provisioning with chef solo, specifying a cookbooks path, roles |
|
112 # path, and data_bags path (all relative to this Vagrantfile), and adding |
|
113 # some recipes and/or roles. |
|
114 # |
|
115 # config.vm.provision "chef_solo" do |chef| |
|
116 # chef.cookbooks_path = "../my-recipes/cookbooks" |
|
117 # chef.roles_path = "../my-recipes/roles" |
|
118 # chef.data_bags_path = "../my-recipes/data_bags" |
|
119 # chef.add_recipe "mysql" |
|
120 # chef.add_role "web" |
|
121 # |
|
122 # # You may also specify custom JSON attributes: |
|
123 # chef.json = { mysql_password: "foo" } |
|
124 # end |
|
125 |
|
126 # Enable provisioning with chef server, specifying the chef server URL, |
|
127 # and the path to the validation key (relative to this Vagrantfile). |
|
128 # |
|
129 # The Opscode Platform uses HTTPS. Substitute your organization for |
|
130 # ORGNAME in the URL and validation key. |
|
131 # |
|
132 # If you have your own Chef Server, use the appropriate URL, which may be |
|
133 # HTTP instead of HTTPS depending on your configuration. Also change the |
|
134 # validation key to validation.pem. |
|
135 # |
|
136 # config.vm.provision "chef_client" do |chef| |
|
137 # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" |
|
138 # chef.validation_key_path = "ORGNAME-validator.pem" |
|
139 # end |
|
140 # |
|
141 # If you're using the Opscode platform, your validator client is |
|
142 # ORGNAME-validator, replacing ORGNAME with your organization name. |
|
143 # |
|
144 # If you have your own Chef Server, the default validation client name is |
|
145 # chef-validator, unless you changed the configuration. |
|
146 # |
|
147 # chef.validation_client_name = "ORGNAME-validator" |
|
148 end |