/
Vagrantfile
115 lines (79 loc) · 3.02 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# -*- mode: ruby -*-
# vi: set ft=ruby sw=2 :
require './vagrant-mongo/lib/vagrant_init.rb'
Vagrant::Config.run do |config|
### World wide configure
# Which base box to use, or fetch if not present
config.vm.box = "replicaset"
config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
# Use puppet, and the replicaset.pp manifest
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "mongo.pp"
puppet.module_path = "puppet/modules"
end
### Per-server configuration
config.vm.define :primaryauth do |primaryauth|
# Configure the hostname and IP
# You should probably update your local /etc/hosts with this info
primaryauth.vm.network :hostonly, "172.16.1.10"
primaryauth.vm.host_name = "primaryauth.rs.local"
# The ReplicaSet name, and content of the keyfile if we want auth
primaryauth.mongo.rs = "RSAuth"
primaryauth.mongo.auth = "random string"
# ReplicaSet config entry ID
primaryauth.mongo.id = 0
# The priority of this member to become primaryauth
primaryauth.mongo.priority = 20
end
config.vm.define :secondaryauth do |secondaryauth|
secondaryauth.vm.network :hostonly, "172.16.1.11"
secondaryauth.vm.host_name = "secondaryauth.rs.local"
secondaryauth.mongo.rs = "RSAuth"
secondaryauth.mongo.auth = "random string"
secondaryauth.mongo.id = 1
secondaryauth.mongo.priority = 10
end
config.vm.define :tertiaryauth do |tertiaryauth|
tertiaryauth.vm.network :hostonly, "172.16.1.12"
tertiaryauth.vm.host_name = "tertiaryauth.rs.local"
tertiaryauth.mongo.rs = "RSAuth"
tertiaryauth.mongo.auth = "random string"
tertiaryauth.mongo.id = 2
# Make this one arbiter
tertiaryauth.mongo.arbiter = true
end
config.vm.define :standaloneauth do |standaloneauth|
standaloneauth.vm.network :hostonly, "172.16.2.10"
standaloneauth.vm.host_name = "standaloneauth.local"
standaloneauth.mongo.auth = "true"
standaloneauth.mongo.id = 42
end
### And now without authentication
config.vm.define :primary do |primary|
primary.vm.network :hostonly, "172.16.3.10"
primary.vm.host_name = "primary.rs.local"
primary.mongo.rs = "RS"
primary.mongo.id = 0
primary.mongo.priority = 20
end
config.vm.define :secondary do |secondary|
secondary.vm.network :hostonly, "172.16.3.11"
secondary.vm.host_name = "secondary.rs.local"
secondary.mongo.rs = "RS"
secondary.mongo.id = 1
secondary.mongo.priority = 10
end
config.vm.define :tertiary do |tertiary|
tertiary.vm.network :hostonly, "172.16.3.12"
tertiary.vm.host_name = "tertiary.rs.local"
tertiary.mongo.rs = "RS"
tertiary.mongo.id = 2
tertiary.mongo.arbiter = true
end
config.vm.define :standalone do |standalone|
standalone.vm.network :hostonly, "172.16.4.10"
standalone.vm.host_name = "standalone.local"
standalone.mongo.id = 42
end
end