Search code examples
puppet

Installing a puppet module on master with Puppetfile


I'm using R10K to manage my configuration files.

I want to install a puppet module on my master server using a Puppet file.

I go to the branch and add the following to Puppetfile:

mod 'puppetlabs-certregen', '0.2.0'

I then run puppet agent -t on the server. It seems the command is successful, in that the commands in my manifest are run, but when I run puppet certregen healthcheck the module doesn't seem to be installed.

What's the correct way to use the Puppetfile to install a module?


Solution

  • The Puppetfile is similar to a Ruby Gemfile, Python requirements.txt: it lists dependancies which are then installed by a separate tool.

    For Puppetfiles, this is r10k.

    It's documented here https://puppet.com/docs/pe/2018.1/puppetfile.html

    You can also directly download the module with the command line:

    puppet module install puppetlabs-certregen
    Notice: Downloading from https://forgeapi.puppet.com ...
    Notice: Installing -- do not interrupt ...
    /Users/petersouter/.puppetlabs/etc/code/modules
    └─┬ puppetlabs-certregen (v0.2.0)
      └── puppetlabs-stdlib (v4.17.1)
    

    Note, however, that r10k and puppet module install don't play well together:

    Restriction: If you are using Code Manager or r10k, do not install, update, or uninstall modules with the puppet module command. With code management, you must install modules with a Puppetfile. Code management purges modules that were installed with the puppet module command. See the Puppetfile documentation for instructions.