Skip to content

Instantly share code, notes, and snippets.

@Nagyman
Created August 7, 2015 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nagyman/9c3374558b7855526065 to your computer and use it in GitHub Desktop.
Save Nagyman/9c3374558b7855526065 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Refer to http://docs.vagrantup.com/v2/provisioning/salt.html
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
VM_BOX = "ubuntu/trusty64" # 14.04 LTS
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :saltmaster do |saltmaster|
saltmaster.vm.box = VM_BOX
saltmaster.vm.host_name = 'saltmaster.local'
saltmaster.vm.network "private_network", ip: "192.168.50.10"
saltmaster.vm.synced_folder "../../", "/srv/salt"
# Fix tty problems
saltmaster.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
saltmaster.vm.provision :salt do |salt|
#salt.saltmaster = "etc/saltmaster"
salt.master_key = "keys/saltmaster.pem"
salt.master_pub = "keys/saltmaster.pub"
# Upload keys to master, thereby pre-seeding it before use.
# Example: {minion_name:/path/to/key.pub}
salt.seed_master = {
"web" => "keys/web.pub",
}
salt.install_type = "stable"
salt.install_master = true
salt.no_minion = true
salt.verbose = true
salt.colorize = true
# -P allows for pip based installations
# See: https://github.com/UtahDave/salt-vagrant-demo/pull/8
salt.bootstrap_options = "-P"
end
# Workaround for vagrant issue #5973
# See: https://github.com/mitchellh/vagrant/issues/5973#issuecomment-123506342
saltmaster.vm.provision "shell",
inline: "sudo cp /vagrant/etc/saltmaster /etc/salt/master && sudo service salt-master restart"
end
# VM for primary website (nginx & uwsgi)
config.vm.define :web do |web|
web.vm.box = VM_BOX
web.vm.host_name = 'webapps.local'
web.vm.network "private_network", ip: "192.168.50.11"
web.vm.provision :salt do |salt|
# salt.web = "etc/webapps"
salt.minion_key = "keys/web.pem"
salt.minion_pub = "keys/web.pub"
salt.install_type = "stable"
salt.verbose = true
salt.colorize = true
# -P allows for pip based installations
salt.bootstrap_options = "-P"
end
# Workaround for vagrant issue #5973
# See: https://github.com/mitchellh/vagrant/issues/5973#issuecomment-123506342
web.vm.provision "shell",
inline: "sudo cp /vagrant/etc/web /etc/salt/minion && sudo service salt-minion restart"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment