Created
October 10, 2013 15:21
-
-
Save viq/6920190 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
#require 'vagrant-salt' | |
# apart from the middleware node, create | |
# this many nodes in addition to the middleware | |
INSTANCES=2 | |
# the nodes will be called middleware.example.net | |
# and node0.example.net, you can change this here | |
DOMAIN="example.net" | |
SUBNET="192.168.55" | |
MEMORY=384 | |
Vagrant::Config.run do |config| | |
config.vm.define :master do |vmconfig| | |
## Chose your base box | |
vmconfig.vm.box = "arch" | |
#config.vm.box = "precise64" | |
vmconfig.vm.network :private_network, ip: "#{SUBNET}.10" | |
vmconfig.vm.hostname = "saltmaster" | |
#vmconfig.vm.hostname = "master.#{DOMAIN}" | |
vmconfig.hostmanager.aliases = "salt" | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", MEMORY] | |
end | |
## For local master, mount your file_roots | |
vmconfig.vm.synced_folder "salt/roots/", "/srv/" | |
#vmconfig.vm.synced_folder "salt/pubkeys/", "/srv/pubkeys/" | |
config.vm.provision :hostmanager | |
#config.vm.provision "shell", path: "prepare.sh" | |
config.vm.provision :salt do |salt| | |
# If you need bleeding edge salt | |
#salt.install_type = "stable" | |
salt.install_type = "git" | |
salt.install_args = "develop" | |
# Install a master on this machine | |
salt.install_master = true | |
#salt.no_minion = true | |
# Default will not install / update salt binaries if they are present | |
# Use this option to always install | |
salt.always_install = false | |
# If you need an updated bootstrap script, or a custom one | |
#salt.bootstrap_script = "salt/custom-bootstrap-salt.sh" | |
salt.bootstrap_script = "salt-bootstrap/bootstrap-salt.sh" | |
# Pass extra flags to bootstrap script | |
#salt.bootstrap_options = "-D -k /srv/key/" | |
#salt.bootstrap_options = "-k /srv/pubkeys/" | |
salt.bootstrap_options = "-D" | |
# Config Options | |
salt.minion_config = "salt/minion" | |
salt.master_config = "salt/master" | |
# 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" | |
salt.minion_key = "salt/key/minion.pem" | |
salt.minion_pub = "salt/key/minion.pub" | |
# Pre-seed your master (recommended) | |
salt.seed_master = {saltmaster: salt.minion_pub} | |
INSTANCES.times do |i| | |
salt.seed_master = {minion"#{i}": salt.minion_pub} | |
end | |
#INSTANCES.times do |i| | |
#salt.seed_master = { minion0: "salt/pubkeys/minion0" } | |
#end | |
# Gives more output, such as fromt bootstrap script | |
salt.verbose = true | |
# If your distro does not use /tmp, you can use another dir | |
salt.temp_config_dir = "/tmp" | |
#salt.accept_keys = true | |
salt.run_highstate = true | |
end | |
end | |
INSTANCES.times do |i| | |
config.vm.define "minion#{i}".to_sym do |vmconfig| | |
vmconfig.vm.box = "arch" | |
vmconfig.vm.network :private_network, ip: "#{SUBNET}.%d" % (10 + i + 1) | |
vmconfig.vm.hostname = "minion%d" % i | |
#vmconfig.vm.hostname = "minion%d.#{DOMAIN}" % i | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", MEMORY] | |
end | |
config.vm.provision :hostmanager | |
#config.vm.provision "shell", path: "prepare.sh" | |
config.vm.provision :salt do |salt| | |
# Config Options | |
salt.minion_config = "salt/minion" | |
salt.master_config = "salt/master" | |
# 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" | |
# 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" | |
# Bootstrap Options Below | |
# See options here: | |
# http://bootstrap.saltstack.org | |
# If you need bleeding edge salt | |
salt.install_type = "stable" | |
#salt.install_type = "git" | |
#salt.install_args = "develop" | |
# Install a master on this machine | |
salt.install_master = false | |
# Pre-seed your master (recommended) | |
# Can also install syndic: | |
# salt.install_syndic = true | |
# Minion is on by default, but can be disabled: | |
# salt.no_minion = true | |
# Actions | |
# Normally we want to run state.highstate to provision the machine | |
salt.run_highstate = true | |
# If you are using a master with minion setup, you may accept keys | |
# If keys have already been except, it will pass | |
# DEPRECATED | |
#salt.accept_keys = true | |
# Default will not install / update salt binaries if they are present | |
# Use this option to always install | |
salt.always_install = true | |
# Gives more output, such as fromt bootstrap script | |
salt.verbose = true | |
# Pass extra flags to bootstrap script | |
salt.bootstrap_options = "-D" | |
# If you need an updated bootstrap script, or a custom one | |
#salt.bootstrap_script = "salt/custom-bootstrap-salt.sh" | |
salt.bootstrap_script = "salt-bootstrap/bootstrap-salt.sh" | |
# If your distro does not use /tmp, you can use another dir | |
salt.temp_config_dir = "/tmp" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment