-2

I'm having some trouble using parameters on puppet modules, here is what I'm doing:

init.pp

node "example_node.example_domain" {

 include repositories("TESTS")

}

manifest of repositories module

class repositories($repository) {

notify{"The repository is: ${repository}": }    

}

Then the result is:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Unknown function repositories at /etc/puppet/environments/test/manifests/init.pp:2 on node example_node.example_domain

What am I doing wrong? All I want is to pass a parameter to a module because each server will have its own invocation to this module and their particular parameter.

Thanks to all of you!

1

Take a look at the fine manual that explains how "Include-like behavior relies on external data and defaults for class parameter values". If you have to pass parameters then use the Resource-like declaration:

repositories{ 'some_name':
  repository => 'TESTS'
}
  • Thank you for your answer, but I'm looking something similar to: include repositories("TESTS") and then another server re-use the same module like: include repositories("PRO") and then another like: include repositories("PRO2") – Alvaro Gomez Aug 31 '15 at 8:08
  • The syntax you keep trying to use is wrong. Puppet resources and classes are instantiated with arguments in the manner that this answer demonstrates. – womble Aug 31 '15 at 8:11
  • Ok, I get it, but how can you pass the parameter through the init.pp manifest file? – Alvaro Gomez Aug 31 '15 at 8:18

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.