Skip to content

Instantly share code, notes, and snippets.

@brianz brianz/Vagrantfile
Created Jul 24, 2014

Embed
What would you like to do?
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'fileutils'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
box = {
:django_fwd => 9000,
:elasticsearch_fwd => 9200,
:ip_address => '192.168.42.3',
}
WEBAPP_DIR = "../cc"
SALT_BASE_DIR = "../cc-devops.git/salt"
if ! File.directory?(SALT_BASE_DIR) || ! File.directory?(WEBAPP_DIR)
print "Missing folders. "
puts "Please ensure the following directories exist before using Vagrant"
puts "\n\t " + WEBAPP_DIR
puts "\t " + SALT_BASE_DIR + "\n"
exit 1
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hansode/centos-6.5-x86_64"
config.vm.network :forwarded_port, guest: 9000, host: box[:django_fwd]
config.vm.network :forwarded_port, guest: 9200, host: box[:elasticsearch_fwd]
config.vm.hostname = "vagrant.cc-dev.com"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network :private_network, ip: box[:ip_address]
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder.
config.vm.synced_folder WEBAPP_DIR, "/home/vagrant/cc"
# Mount our salt files in the expected locaiton on the VM
config.vm.synced_folder File.join(SALT_BASE_DIR, "salt"), "/srv/salt/"
config.ssh.forward_agent = true
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant.
config.vm.provider :virtualbox do |vb|
vb.customize [
"modifyvm", :id,
"--memory", "2048"
]
end
## Use all the defaults:
config.vm.provision :salt do |salt|
salt.install_master = false
salt.colorize = true
salt.log_level = "info"
salt.minion_config = File.join(SALT_BASE_DIR, "etc/vagrant-minion")
salt.run_highstate = true
# Install this branch from git. Mainly for:
# https://github.com/saltstack/salt/issues/13827
salt.install_type = "git"
salt.install_args = "2014.7"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.