Last Updated: September 09, 2019
· spanneberg

Automatically update Puppet in your Vagrant precise64 box

I'm a big fan of Vagrant (and Puppet) and often use it to craft together test environments and test Puppet manifests and modules that are used elsewhere later. Often, I use the precise64 box as a starting point, but this has still Puppet 2.7 packaged in it. So I came with this little script ( to update Puppet on 'vagrant up' if applicable:


if [ ! -e /tmp/puppet-updated ]; then
  wget -O /tmp/puppetlabs-release-precise.deb
  dpkg -i /tmp/puppetlabs-release-precise.deb
  apt-get update
  apt-get --assume-yes install puppet
  touch /tmp/puppet-updated

Now this can simply be included in your Vagrantfile with a shell provisioner before (!) your Puppet provisioner, and if Puppet is not up-to-date yet, it'll be updated:

config.vm.provision :shell, :path => "scripts/"

If you're using different boxes, look at for adjusting the script to fit your box' OS.

1 Response
Add your response

That temp file (/tmp/puppet-updated) gets destroyed anything the machine is restarted. Best to put that marker file elsewhere.

over 1 year ago ·