Skip to content

Instantly share code, notes, and snippets.

@acharlieh
Created December 13, 2013 20:28
Show Gist options
  • Save acharlieh/7950826 to your computer and use it in GitHub Desktop.
Save acharlieh/7950826 to your computer and use it in GitHub Desktop.
Vagrantfile for demonstrating hostname / hostname -f oddities
# -*- mode: ruby -*-
# vi: set ft=ruby :
@boxes = {
centos510: {box:'opscode_centos-5.10_provisionerless',box_url:'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box'},
centos65: {box:'opscode_centos-6.5_provisionerless',box_url:'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box'},
}
Vagrant.configure('2') do |config|
config.berkshelf.enabled = false
config.vbguest.auto_update = false
@boxes.each_with_index do |(name,box_data),index|
short_name = name.to_s
config.vm.define "#{short_name}_fqdn".to_sym do |cfg|
cfg.vm.hostname = "#{short_name}.example.com"
cfg.vm.network :private_network, ip: "33.33.33.#{10+index*2}"
cfg.vm.box = box_data[:box]
cfg.vm.box_url = box_data[:box_url]
end
config.vm.define name do |cfg|
cfg.vm.hostname = short_name
cfg.vm.network :private_network, ip: "33.33.33.#{11+index*2}"
cfg.vm.box = box_data[:box]
cfg.vm.box_url = box_data[:box_url]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment