Skip to content

Instantly share code, notes, and snippets.

@hunner
Last active February 19, 2017 01:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hunner/6134154 to your computer and use it in GitHub Desktop.
Save hunner/6134154 to your computer and use it in GitHub Desktop.
Vagrantfile example with vagrant-hosts and vagrant-auto_network
Vagrant.configure('2') do |config|
# Specify box files
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
# Create web frontend
config.vm.define 'web.example.com' do |node|
node.vm.network :forwarded_port, guest: 443, host: 4443
node.vm.network :forwarded_port, guest: 80, host: 8080
# Automatically configure networking and /etc/hosts
node.vm.extend AutoNetwork::Mixin
node.vm.auto_network!
node.vm.provision :hosts
end
# Create api backend on the same network
config.vm.define 'api.example.com' do |node|
# Automatically configure networking and /etc/hosts
node.vm.extend AutoNetwork::Mixin
node.vm.auto_network!
node.vm.provision :hosts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment