forked from signed8bit/devstacked
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
66 lines (55 loc) · 2.18 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
66
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
require 'fileutils'
$env = YAML::load_file('devstacked-hosts.yml')
# Create the local.yml variables file if not already present
unless File.exist?('vars/local.yml')
FileUtils.mkpath('vars')
FileUtils.touch('vars/local.yml')
end
# Create the repos directory if not already present
unless File.exist?('repos')
FileUtils.mkpath('repos')
end
Vagrant.configure('2') do |config|
# Create and provision each host as defined devstacked-hosts.yml
$env['hosts'].each do |host_name, host_config|
config.vm.define host_name do |host|
host.vm.box = 'hashicorp/precise64'
host.vm.network 'private_network', :ip => host_config['private_ip']
host.vm.host_name = "#{host_name}.local"
host.vm.synced_folder './', '/vagrant', :disabled => true
host.vm.synced_folder './repos', '/repos', :disabled => false
if host_config['ports']
host_config['ports'].each do |port|
host.vm.network 'forwarded_port', :guest => port['guest'],
:host => port['host']
end
end
# VirtualBox config
host.vm.provider :virtualbox do |vbox|
if host_config['memory']
vbox.customize ['modifyvm', :id, '--memory',
host_config['memory']]
end
vbox.customize ['modifyvm', :id, '--usb', 'off']
end
# VMware config
host.vm.provider :vmware_fusion do |vmware|
if host_config['memory']
vmware.vmx['memsize'] = host_config['memory']
end
vmware.vmx['numvcpus'] = '1'
vmware.vmx['virtualHW.version'] = '10'
vmware.vmx['vhv.enable'] = 'TRUE'
vmware.gui = false
end
# Ansible provisioning using the generated host based inventory
host.vm.provision 'ansible' do |ansible|
ansible.playbook = 'devstacked-playbook.yml'
#ansible.verbose = 'vvvv'
end
end
end
end