Skip to content

Instantly share code, notes, and snippets.

@schwuk
Created January 30, 2014 14:58
Show Gist options
  • Save schwuk/8710239 to your computer and use it in GitHub Desktop.
Save schwuk/8710239 to your computer and use it in GitHub Desktop.
Vagrantfile that installs the latest version of Puppet into the official Ubuntu 12.04 Vagrant image. Also opens up port 5000 (default Foreman port).
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
INITIAL_PROVISION=/var/cache/initial_provision
DISTRIB_CODENAME=$(lsb_release --codename --short)
DEB="puppetlabs-release-${DISTRIB_CODENAME}.deb"
if [ ! -e $INITIAL_PROVISION ]
then
sudo apt-get update
sudo apt-get install --yes language-pack-en
sudo apt-get remove --yes puppet*
wget -q http://apt.puppetlabs.com/$DEB
sudo dpkg -i $DEB
rm -f $DEB
sudo apt-get update
sudo apt-get install --yes puppet
sudo puppet module install puppetlabs/apt
sudo touch $INITIAL_PROVISION
fi
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :forwarded_port, guest: 5000, host: 5000
config.vm.hostname = "vagrant.example.com"
config.vm.provision :shell, :inline => $script
config.vm.provision :puppet do |puppet|
puppet.options = "--hiera_config /vagrant/hiera.yaml"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment