-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
66 lines (53 loc) · 2.31 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This Vagrantfile contains some configuration option that you can
# tweak for your project.
# It then loads the "main" Vagrantfile from the submodule.
require 'yaml'
class CustomConfig
# Those accessors will be used by the Vagrantfile
attr_accessor :project_name # project name (currently unused by the Vagrant file)
attr_accessor :hostname # main hostname of the box
attr_accessor :hostnames # alternative hostnames (array)
attr_accessor :box_ip # IP of the box
attr_accessor :ansible_local # use 'ansible_local' provisionner ?
attr_accessor :playbook # path to the playbook
attr_accessor :extra_vars # extra variables to pass to Ansible
attr_accessor :lxc_box_url # name of the virtualbox box
attr_accessor :lxc_box_name # url of the virtualbox box
attr_accessor :vbox_box_url # name of the lxc box
attr_accessor :vbox_box_name # url of the lxc box
# Retrieve the values of 'virtualization/parameters.yml' so that
# they can be used by Vagrant. If you need to change those values
# prefer editing the parameters.yml file instead.
def initialize
parameters_file = ENV.fetch('VIRTUALIZATION_PARAMETERS_FILE', 'virtualization/parameters.yml')
config = YAML::load(File.open(parameters_file))
@lxc_box_url = config['lxc_box_url'] || "http://vagrantbox-public.liip.ch/liip-jessie64-lxc.box"
@lxc_box_name = config['lxc_box_name'] || 'jessie64-lxc'
@vbox_box_url = config['vbox_box_url'] || 'http://vagrantbox-public.liip.ch/liip-jessie64.box'
@vbox_box_name = config['vbox_box_name'] || 'jessie64'
@project_name = config['project_name'] || "example"
@hostname = config['hostname'] || "#{@project_name}.lo"
@hostnames = config['hostnames'] || Array.new
@box_ip = config['box_ip'] || "10.10.10.10"
@ansible_local = true
@playbook = config['playbook'] || "virtualization/playbook.yml"
@extra_vars = {}
end
# Modify this if you need to determine a list from hostnames
# from a file for example.
def load_aliases
@hostnames
end
def get(name, default = nil)
if self.respond_to?(name)
self.send(name)
elsif default.nil?
raise "[CONFIG ERROR] '#{name}' cannot be found and no default provided."
else
default
end
end
end
load 'virtualization/drifter/Vagrantfile'