-
Notifications
You must be signed in to change notification settings - Fork 11
/
Vagrantfile
56 lines (48 loc) · 1.68 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Assumes a box from https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box
# This sets up 4 instances, one with fabric-store and 3 nodes.
fabric_nodes = {
'store' => {
'ip' => '192.168.70.100',
'playbook' => 'fabric-store.yml'
},
'node1' => {
'ip' => '192.168.70.101',
'playbook' => 'fabric-node.yml'
},
'node2' => {
'ip' => '192.168.70.102',
'playbook' => 'fabric-node.yml'
},
'node3' => {
'ip' => '192.168.70.103',
'playbook' => 'fabric-node.yml'
},
}
Vagrant.configure("2") do |config|
config.vm.box = 'centos65-x86_64-20140116'
config.vm.box_url = 'https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box'
config.vm.boot_timeout = 600
# Create all three nodes identically except for name and ip
fabric_nodes.each_pair { |node, node_params|
config.vm.define node do |node_config|
node_config.vm.hostname = "#{node}.local"
node_config.vm.network :private_network, ip: node_params['ip']
node_config.vm.provision :ansible do |ansible|
ansible.groups = {
"stores" => ['store'],
"nodes" => ['node1', 'node2', 'node3'],
"all_groups:children" => ["stores", "nodes"]
}
ansible.verbose = 'vv'
ansible.extra_vars = { ansible_ssh_user: 'vagrant' }
#ansible.inventory_path = 'provisioning/ansible_hosts'
ansible.playbook = 'provisioning/' + node_params['playbook']
ansible.host_key_checking = false
# Disable default limit (required with Vagrant 1.5+)
ansible.limit = 'all'
end
end
}
end