Sathish Kumar
Sathish Kumar

Reputation: 331

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

Upvotes: 1

Views: 1074

Answers (2)

Manoj K Samtani
Manoj K Samtani

Reputation: 1

if we are exporting any variable start with FACTER_ , will be treated as facter on puppet/facter installed machine. Like

export FACTER_test_value='myname'

facter |grep -i test_value

test_value => myname

So, with mco we can use following commandto pass facter value

mco rpc shell start command='export FACTER_test_fact=“true1"; puppet agent -t --tags testmodule' -I target-server-name

Upvotes: 0

Felix Frank
Felix Frank

Reputation: 8223

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.

Upvotes: 1

Related Questions