-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathVagrantfile
39 lines (36 loc) · 1.21 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
# Defines our Vagrant environment
#
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
N = 3
(1..N).each do |i|
config.vm.define "mongo#{i}" do |node|
node.vm.box = "centos/7"
node.vm.hostname = "mongo#{i}"
node.vm.network :private_network, ip: "11.0.0.1#{i}"
node.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
node.vm.provision :shell, path: "bootstrap.sh", run: "once"
if i == N
node.vm.provision :ansible do |ansible|
ansible.playbook = "mongodb/site.yml"
ansible.limit = "all"
ansible.sudo = true
ansible.host_vars = {
"mongo1" => {"mongod_port" => 2700},
"mongo2" => {"mongod_port" => 2701},
"mongo3" => {"mongod_port" => 2702}
}
ansible.groups = {
"mongo_servers" => ["mongo1", "mongo2", "mongo3"],
"replication_servers" => ["mongo1", "mongo2", "mongo3"],
"mongoc_servers" => ["mongo1", "mongo2", "mongo3"],
"mongos_servers" => ["mongo1", "mongo2"]
}
end
end
end
end
end