Search code examples
parameterstagspuppet

Puppet - mco - passing parameters


I have different manifest files in puppet server. two questions I have.

  1. How can I push a specific manifest file to be run on a set of agents using mco command?
  2. How can I pass parameters to the manifest file from puppet master commandline (from mco).

Is there a way to use tags to do it? ie, do different set of operations using different tags


Solution

  • The master picks the manifest for each agent going by the respective $certname value. It is used for looking up node blocks in your manifest.

    However, you are not bound to structure your manifest by node. If security is not much of a concern, you could use a custom fact like so

    # site.pp
    case $::task {
      'taskA': { include taskA }
      'taskB': { include taskB }
      ...
    }
    

    Then pass the desired value using

    FACTER_task=taskB puppet agent --onetime --no-daemonize
    

    It should not be difficult to teach mco to do something to that effect.