1

I'm using Puppet to provision a Vagrant box and would like to include a 3rd party package provider (https://github.com/torrancew/puppet-cpanm)

The README.md in that repo shows how to use the provider within a manifest, but it assumes (I believe) a puppet master which has, or is aware of, this provider. With my Vagrant setup I don't actually have a puppet master (or is Vagrant acting as one?) so I'm not sure how to actually use the package provider class (https://github.com/torrancew/puppet-cpanm/blob/master/lib/puppet/provider/package/cpanm.rb)

What do I need to do, either in my Vagrantfile, my Puppet manifest(s), or elsewhere in the guest/host system configuration to allow me to use this package provider?

1 Answers1

1

tl;dr:

  1. Ensure the puppet provider module is installed and on the modulepath.
  2. Ensure the underlying 3rd party tool is also installed. This can be handled by the module itself by adding include cpanm to your manifest(s).

Details

You must have the provider module installed and on the modulepath for Puppet to see it.

Using a provider always goes through a suitability check, which you can see in the commands/confines of the provider:

confine  :exists => ['/usr/bin/cpanm', '/usr/bin/perldoc']
commands :cpanm  => '/usr/bin/cpanm'

Suitability means the provider states the above items need to exist for the provider to be active. There is a message that tells you when a provider isn't suitable that shows up when you run Puppet with --debug --verbose, done in a Vagrantfile like so:

config.vm.provision :puppet, :options => ["--debug --trace --verbose"] do |puppet|
  #other settings here
end

Working Example

For a full working example of using a third party package provider (Chocolatey), see

However, now that the Chocolatey provider can handle installing itself, it becomes as simple as making sure the provider is installed and then adding the following to the manifest:

include chocolatey

Bringing it back full cycle, it appears that cpanm can also handle installing itself:

include cpanm
ferventcoder
  • 347
  • 3
  • 4
  • 12