Question

I'm working with vagrant & puppet to install my dev environment.

I use a shell provisioner to install the puppet's modules :

config.vm.provision :shell do |shell|
    shell.inline = "puppet module install --force garethr-docker"
end

But when I launch vagrant provision, I see that puppet does not install the module dependencies (stdlib, apt & stahma-epel for this particular module).

On the other hand, if I remove --force, the dependencies are correctly installed, but vagrant provision will only work one time since puppet throw an error the second time ("module already installed").

How can I overcome this ? Thx.

PS, my complete Vagrantfile :

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "phusion/ubuntu-14.04-amd64"

  config.vm.provision :shell do |shell|
    shell.inline = "puppet module install --force garethr-docker"
  end

  config.vm.provision "puppet" do |puppet|
    puppet.manifests_path = "puppet/manifests"
    puppet.manifest_file  = "dockervm.pp"
    puppet.options="--verbose --debug"
  end
end
Was it helpful?

Solution

Check whether the module is installed before attempting to install it again. For instance:

{ puppet module list | grep garethr-docker > /dev/null; } || \
    puppet module install garethr-docker
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top