How to install puppet module from GitHub?

I personally don't use r10k or anything like that.
At the end of the day a puppet module is just a directory in your modules folder.
If you are using git to manage your modules you could add it as a submodule, like this:

cd modules
git submodule add https://github.com/camptocamp/puppet-apache_c2c.git apache_c2c

Of course this isn't doing any resolution of dependencies.
You'll have to check the metadata.json yourself and install those.
Which is OK for my case, we don't add modules very often.


Using librarian-puppet:

gem install librarian-puppet

Check modulepath on Puppet master:

puppet config print modulepath --section master

Which will give you e.g. /etc/puppet/environments/production/modules.

Then create Puppetfile one level above path modulepath. i.e. /etc/puppet/environments/production/Puppetfile:

forge 'https://forgeapi.puppetlabs.com'

mod 'camptocamp-nagios', :git => 'https://github.com/camptocamp/puppet-nagios.git'

And run librarian-puppet install from the folder where is Puppetfile located.

In .librarian/puppet/config you can specify custom path for modules installation (relative from Puppetfile):

LIBRARIAN_PUPPET_PATH: environments/production/modules