-
Notifications
You must be signed in to change notification settings - Fork 18
/
Vagrantfile.vbox
87 lines (72 loc) · 2.43 KB
/
Vagrantfile.vbox
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# vi: set ft=ruby :
#
VAGRANTFILE_API_VERSION = '2'
box = 'box-cutter/centos67'
boxes = [
{
:name => :jenkins,
:ram => 1512,
:book => 'jenkins',
:ip => "2"
},
{
:name => :zabbix,
:ram => 512,
:book => 'zabbix',
:ip => "3"
},
]
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.hostmanager.enabled = true
config.hostmanager.include_offline = true
config.hostmanager.manager_host = true
config.vm.provision :hostmanager
config.ssh.private_key_path = "vagrant-keys/vagrant"
config.ssh.insert_key = false
if Vagrant.has_plugin?("vagrant-cachier")
# Configure cached packages to be shared between instances of the same base box.
# More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
config.cache.scope = :box
end
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.no_proxy = "localhost,127.0.0.1"
end
boxes.each do |opts|
config.vm.define opts[:name] do |machine|
machine.vm.box = box
machine.vm.hostname = opts[:name]
machine.vm.network :private_network, ip: "192.168.67.#{opts[:ip]}"
machine.vm.provider :virtualbox do |virtual|
virtual.customize ['modifyvm', :id, '--cpus', "2" ]
virtual.customize ['modifyvm', :id, '--memory', opts[:ram] ]
virtual.customize ['modifyvm', :id, '--name', opts[:name].to_s ]
virtual.customize ['modifyvm', :id, '--natdnsproxy1', "off"]
virtual.customize ['modifyvm', :id, '--natdnshostresolver1', "off"]
virtual.customize ['modifyvm', :id, '--usbehci', "off"]
end
config.vm.provision "shell",
inline: "sudo yum install -y libselinux-python"
config.vm.provision "shell",
inline: "sudo setenforce 0 | echo"
config.vm.provision :ansible do |ansible|
if defined? ENV['TAGS']
ansible.tags = ENV['TAGS']
end
if defined? ENV['START_AT_TASK']
ansible.start_at_task = ENV['START_AT_TASK']
end
#ansible.verbose = 'vvv'
ansible.sudo = true
ansible.playbook = "vagrant-#{opts[:book]}.yml"
ansible.inventory_path= 'vagrant'
ansible.vault_password_file = 'vagrant-vault'
ansible.limit = opts[:name].to_s
ansible.raw_ssh_args = ['-o ControlMaster=auto', '-o ControlPersist=30m']
ansible.extra_vars = {
'deploy_environment' => 'vagrant',
}
end
end
end
end
# -*- mode: ruby -*-