I'm looking at a module for learning purposes. My understanding was that everything needs to be in a class or definition, however below the module has a definition in init.pp however after the definiton "define netb {...} a new code block is started "{}", my thoughts run to what is this code block? what is its role and how does it fit in the scope of the module? Is this code block executed after some point or is it dependent on the "define netb" statement?

define netb (

) {

 .....do something here with code e.g. set variables or check conditionins


Appreciate any guidance on this.

Thanks Dan

2 Answers 2


Assuming no typos, there is only one block of code there. Inside ( ) are the parameters and inside { } is the code to be executed.

  • Thanks. Does this block of execution code get executed every time you use this defined type in the module?
    – Dan
    Feb 7, 2013 at 23:33
  • Would need to take a look at the whole module to be certain when it runs. Usually init.pp is run every time the module is called from a servers manifest. github.com/puppetlabs/puppetlabs-firewall this firewall module is a good example.
    – Andy H
    Feb 7, 2013 at 23:39

It is a define. It would be called with

<module>::netb { "some name": ifb => "some value" }

in your node definitions, or other modules, or even in the same module. A define kind of makes it look like a built-in type (this is a simplification). The part in the parentheses is the parameter list, and in the braces is the other puppet code that would be applied when this define is used.

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.