How do you create a puppet manifest that 'uses' one of the modules on the puppet forge?

class foo {
    include puppetlabs-git    (<- this doesn't work)

    package {'openssl-devel':
     ensure => latest,

    #package {'git':           (<- commented out because it seems like there is a better way using puppet forge)
    # ensure => installed,

class {'foo': }

http://docs.puppetlabs.com/learning/modules1.html What's the difference between include and require in puppet


You still have to download that module from the forge first:

 puppet module install puppetlabs/git

It will put it in the default modulepath, but you can override that with the --modulepath switch.

You can see the mentioned command at the URL that you mentioned... ;)

You then 'use' that module like this:

include git

You need to install the module first - use the puppet module install puppetlabs-git command on your master.

Once that's done, you can use the module via include git - note that the puppetlabs- prefix is a forge-specific convention and is not included in the module name once it's been installed.

By the way, that module pretty much just does the package {"git": ensure => installed } that you already have there; there's probably not a lot of need to have a separate module for one resource.

  • It's "puppet module install puppetlabs/git". – ThatGraemeGuy May 8 '13 at 8:06
  • 1
    @ThatGraemeGuy Either way works just fine. – Shane Madden May 9 '13 at 0:23

Use following steps to use existing puppet module with your puppet module.

First of all install puppet module which you want to include in your module.

For example if you want to include apache module with your puppet module:

puppet module install puppetlabs/apache 

After this add any class in your module for example:

class foo {
     include apache
     and rest

then make sure you keep your module in /etc/puppetlabs/puppet/modules/ , because by default modules are installed in this directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.