blob: 5fbcfbb7430bb0f2e591cae8e079b718fd699686 [file] [log] [blame]
Ganesh Chandrasekaran8ba2cee2019-02-12 15:01:25 +09001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5VAGRANTFILE_API_VERSION = "2"
6
7Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8 os = "bento/ubuntu-16.04"
9 net_ip = "192.168.50"
10
11 config.vm.define :master, primary: true do |master_config|
12 master_config.vm.provider "virtualbox" do |vb|
13 vb.memory = "2048"
14 vb.cpus = 1
15 vb.name = "master"
16 end
17 master_config.vm.box = "#{os}"
18 master_config.vm.host_name = 'saltmaster.local'
19 master_config.vm.network "private_network", ip: "#{net_ip}.10"
20 master_config.vm.synced_folder "saltstack/salt/", "/srv/salt"
21 master_config.vm.synced_folder "saltstack/pillar/", "/srv/pillar"
22
23 master_config.vm.provision :salt do |salt|
24 salt.master_config = "saltstack/etc/master"
25 salt.master_key = "saltstack/keys/master_minion.pem"
26 salt.master_pub = "saltstack/keys/master_minion.pub"
27 salt.minion_key = "saltstack/keys/master_minion.pem"
28 salt.minion_pub = "saltstack/keys/master_minion.pub"
29 salt.seed_master = {
30 "minion1" => "saltstack/keys/minion1.pub",
31 "minion2" => "saltstack/keys/minion2.pub"
32 }
33
34 salt.install_type = "stable"
35 salt.install_master = true
36 salt.no_minion = true
37 salt.verbose = true
38 salt.colorize = true
39 salt.bootstrap_options = "-P -c /tmp"
40 end
41 end
42
43
44 [
45 ["minion1", "#{net_ip}.11", "1024", os ],
46 ["minion2", "#{net_ip}.12", "1024", os ],
47 ].each do |vmname,ip,mem,os|
48 config.vm.define "#{vmname}" do |minion_config|
49 minion_config.vm.provider "virtualbox" do |vb|
50 vb.memory = "#{mem}"
51 vb.cpus = 1
52 vb.name = "#{vmname}"
53 end
54 minion_config.vm.box = "#{os}"
55 minion_config.vm.hostname = "#{vmname}"
56 minion_config.vm.network "private_network", ip: "#{ip}"
57
58 minion_config.vm.provision :salt do |salt|
59 salt.minion_config = "saltstack/etc/#{vmname}"
60 salt.minion_key = "saltstack/keys/#{vmname}.pem"
61 salt.minion_pub = "saltstack/keys/#{vmname}.pub"
62 salt.install_type = "stable"
63 salt.verbose = true
64 salt.colorize = true
65 salt.bootstrap_options = "-P -c /tmp"
66 end
67 end
68 end
69 end