-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
84 lines (66 loc) · 2.52 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
Vagrant.configure("2") do |config|
# Some vm settings
# Major salt version to install
salt_version = "3006"
# This is the minions local subnet
# Note this also needs to be changed in pillar/mine.sls
net_ip = "192.168.56"
# Number of minions to create not counting the saltmaster
minion_count = 0
# This is so we can use the same ssh key to make it easier to dev against
# Yes it is insecure...
config.ssh.insert_key = false
# Which os to install
#os = "centos/7" # centos7
os = "generic/oracle8"
# Move salt files to all systems to be run locally
config.vm.provision "shell", inline: "chown vagrant /srv"
config.vm.provision "file", source: "salt", destination: "/srv/salt"
config.vm.provision "file", source: "pillar", destination: "/srv/pillar"
config.vm.define "saltmaster", primary: true do |sm|
sm.vm.box = "#{os}"
sm.vm.host_name = 'saltmaster.vagrant.lan'
sm.vm.network "private_network", ip: "#{net_ip}.10"
# Change master hardware specs here
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
# We just use the salt provisioner to install and configure salt
sm.vm.provision :salt do |salt|
salt.install_master = true
salt.verbose = true
salt.colorize = true
salt.install_type = "stable"
salt.version = salt_version
salt.bootstrap_options = "-X -c /tmp -A #{net_ip}.10 -i saltmaster"
end
# We call salt-call --local to configure the saltmaster
sm.vm.provision "shell", inline: "salt-call --local state.apply setup_master"
end
# Setup our minions
minion_count.times do |i|
minion_index = i + 1
config.vm.define "minion#{minion_index}" do |node|
# Change minion hardware specs here
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
node.vm.box = "#{os}"
node.vm.host_name = "minion#{minion_index}.vagrant.lan"
node.vm.network "private_network", ip: "#{net_ip}.1#{minion_index}"
# We just use the salt provisioner to install and configure salt
node.vm.provision :salt do |salt|
salt.install_master = false
salt.verbose = true
salt.colorize = true
salt.install_type = "stable"
salt.version = salt_version
salt.bootstrap_options = "-X -c /tmp -A #{net_ip}.10 -i minion#{minion_index}"
end
# We call salt-call --local to configure each minion
node.vm.provision "shell", inline: "salt-call --local state.apply setup_minion"
end
end
end