-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
136 lines (111 loc) · 5.13 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
domain = 'example.com'
lin_hosts_path = '/etc/hosts'
win_hosts_path = 'C:/Windows/System32/drivers/etc/hosts'
$hosts_script_lin = <<HOSTS
sudo echo 127.0.0.1 localhost > #{lin_hosts_path}
sudo echo 172.16.42.10 salt.#{domain} salt >> #{lin_hosts_path}
sudo echo 172.16.42.11 minion1.#{domain} minion1 >> #{lin_hosts_path}
sudo echo 172.16.42.12 minion2.#{domain} minion2 >> #{lin_hosts_path}
HOSTS
$hosts_script_win = <<HOSTS
echo "127.0.0.1 localhost" | Out-File #{win_hosts_path} -Encoding "ASCII" -Force
echo "172.16.42.10 salt.#{domain} salt" | Out-File #{win_hosts_path} -Encoding "ASCII" -Append -Force
echo "172.16.42.11 minion1.#{domain} minion1" | Out-File #{win_hosts_path} -Encoding "ASCII" -Append -Force
echo "172.16.42.12 minion2.#{domain} minion2" | Out-File #{win_hosts_path} -Encoding "ASCII" -Append -Force
ipconfig /flushdns
HOSTS
Vagrant.configure("2") do |config|
config.vm.define :master do |master_config|
## Choose your base box
master_config.vm.box = "hashicorp/precise64"
master_config.vm.provider "virtualbox" do |vb|
vb.name = "salt-master-precise64"
vb.customize ["modifyvm", :id, "--accelerate3d", "off"]
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--vram", "10"]
vb.customize ["modifyvm", :id, "--vrde", "on"]
vb.customize ["modifyvm", :id, "--vrdeport", "3389"]
end
## For masterless, mount your salt file root
master_config.vm.synced_folder "salt/roots/", "/srv/salt/"
master_config.vm.host_name = "salt.#{domain}"
master_config.vm.network "private_network", ip: '172.16.42.10'
master_config.vm.provision "shell", inline: $hosts_script_lin
## Use all the defaults:
master_config.vm.provision :salt do |salt|
# These are more useful when connecting to a remote master
# and you want to use pre-seeded keys (already accepted on master)
## !! Please do not use these keys in production!
salt.minion_key = "salt/key/minion.pem"
salt.minion_pub = "salt/key/minion.pub"
# Good for multi-vm setups where live minions are expecting
# existing master
## !! Please do not use these keys in production!
salt.master_key = "salt/key/master.pem"
salt.master_pub = "salt/key/master.pub"
# Pre-seed your master (recommended)
salt.seed_master = {"salt" => salt.minion_pub,
"minion1.example.com" => "salt/key/minion1.example.com.pub",
"minion2.example.com" => "salt/key/minion2.example.com.pub"}
salt.install_master = true
salt.master_config = "salt/master"
salt.minion_config = "salt/minion"
salt.run_highstate = true
salt.log_level = "debug"
end
end
config.vm.define :minion1 do |minion_config|
## Choose your base box
minion_config.vm.box = "hashicorp/precise64"
minion_config.vm.provider "virtualbox" do |vb|
vb.name = "salt-minion-precise64"
vb.customize ["modifyvm", :id, "--accelerate3d", "off"]
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--vram", "10"]
vb.customize ["modifyvm", :id, "--vrde", "on"]
vb.customize ["modifyvm", :id, "--vrdeport", "3390"]
end
minion_config.vm.host_name = "minion1.#{domain}"
minion_config.vm.network "private_network", ip: '172.16.42.11'
minion_config.vm.provision "shell", inline: $hosts_script_lin
## Use all the defaults:
minion_config.vm.provision :salt do |salt|
# These are more useful when connecting to a remote master
# and you want to use pre-seeded keys (already accepted on master)
## !! Please do not use these keys in production!
salt.minion_key = "salt/key/minion1.example.com.pem"
salt.minion_pub = "salt/key/minion1.example.com.pub"
salt.minion_config = "salt/minion"
salt.run_highstate = true
salt.log_level = "debug"
end
end
config.vm.define :minion2 do |minion_config|
## Choose your base box
minion_config.vm.box = "lmayorga1980/windows7-sp1"
minion_config.vm.communicator = "winrm"
minion_config.vm.provider "virtualbox" do |vb|
vb.name = "salt-minion-windows"
vb.gui = true
vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--vram", "48"]
vb.customize ["modifyvm", :id, "--vrde", "on"]
vb.customize ["modifyvm", :id, "--vrdeport", "3391"]
end
minion_config.vm.host_name = "minion2.#{domain}"
minion_config.vm.network "private_network", ip: '172.16.42.12'
minion_config.vm.provision "shell", inline: $hosts_script_win
## Use all the defaults:
minion_config.vm.provision :salt do |salt|
# These are more useful when connecting to a remote master
# and you want to use pre-seeded keys (already accepted on master)
## !! Please do not use these keys in production!
salt.minion_key = "salt/key/minion2.example.com.pem"
salt.minion_pub = "salt/key/minion2.example.com.pub"
salt.minion_config = "salt/minion"
salt.run_highstate = true
salt.log_level = "debug"
end
end
end