1

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)
    #https://forge.puppetlabs.com/puppetlabs/git

    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': }
рüффп
  • 620
  • 1
  • 11
  • 25
spuder
  • 1,725
  • 3
  • 26
  • 42

3 Answers3

3

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
Ger Apeldoorn
  • 565
  • 3
  • 10
1

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.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
0

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
     of
     your 
     code....
}

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

kenorb
  • 6,499
  • 2
  • 46
  • 54
yogesh.panchal
  • 103
  • 1
  • 6