forked from contiv/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
60 lines (52 loc) · 1.92 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This Vagrantfile helps test the devtest role on base centos and ubuntu vms
host_env = { }
if ENV['CONTIV_ENV'] then
ENV['CONTIV_ENV'].split(" ").each do |env|
e = env.split("=")
host_env[e[0]]=e[1]
end
end
if ENV["http_proxy"]
host_env["HTTP_PROXY"] = host_env["http_proxy"] = ENV["http_proxy"]
host_env["HTTPS_PROXY"] = host_env["https_proxy"] = ENV["https_proxy"]
host_env["NO_PROXY"] = host_env["no_proxy"] = ENV["no_proxy"]
end
ansible_groups = { }
ansible_playbook = ENV["CONTIV_ANSIBLE_PLAYBOOK"] || "./site.yml"
ansible_tags = ENV["CONTIV_ANSIBLE_TAGS"] || "prebake-for-dev"
ansible_extra_vars = {
"env" => host_env,
"validate_certs" => "no",
}
puts "Host environment: #{host_env}"
Vagrant.configure(2) do |config|
node_name = "host0"
config.vm.define node_name do |node|
node.vm.hostname = node_name
node.vm.box = "puppetlabs/centos-7.2-64-nocm"
node.vm.box_version = "1.0.0"
node.vm.provision "shell" do |s|
#XXX: seems like the centos box has a broken packer binary which
#get's stuck on issuing 'packer --version' removing it manually here
s.inline = "rm -f /usr/sbin/packer"
end
# set the vm's ram and cpu big enough for docker to run fine
node.vm.provider "virtualbox" do |vb|
vb.customize ['modifyvm', :id, '--memory', "4096"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
if ansible_groups["devtest"] == nil then
ansible_groups["devtest"] = [ ]
end
ansible_groups["devtest"] << node_name
node.vm.provision 'ansible' do |ansible|
ansible.groups = ansible_groups
ansible.playbook = ansible_playbook
ansible.extra_vars = ansible_extra_vars
ansible.limit = 'all'
ansible.tags = ansible_tags
end
end
end