On Wednesday, May 8, 2013 8:38:52 AM UTC-5, Robin Jonsson wrote:
>
> Thank you for your reply.
>
> First of, we are kinda aware of that we are not using Puppet as it should 
> be used with the "state management service". But Puppet seemed to be the a 
> great piece of software with great capabilities.
>
> To our problem. Lets say our site.pp looks like this:
>
> #Site.pp
>
> import "nodes_script"
> import "monitor_script"
> import "run_script"
>
> node /^linuxnod\d+$/ {
>        include nodes_script
> }
>
> node 'monitor.rosi.local' {
>        include monitor_script
> }
>
> All works well with our modules. But we would now like to add the module 
> "run_script" to some nodes that can't be "regex:ed". The nodes are present 
> in a file named "hosts". Can I in some way include these nodes to the "node 
> '<nodes>' { include run_script }" in site.pp? So that the run_script is for 
> those nodes presented in "hosts". If not, any suggestion on how we 
> can achieve it?
>
>>
>>
Ah.  You want just the node *names* to come from an external file, not 
entire node definitions.  Sorry, that's not gonna happen.

You have several options.  The most similar to what you asked is to in fact 
provide a whole node definition (only one is needed) for these exceptional 
hosts:

import 'run_script.pp'
node
    'node1.my.com',
    'node2.my.com',
    ...
    'node42.my.com' {
  include run_script
}

Then 'import' that into site.pp.  You will recognize that that has the form 
of a list of node names, bracketed by a small amount of decoration, so it's 
not too different from what you asked.

As I already said, you can also use an ENC instead of a flat file to feed 
the information to Puppet, including (but not restricted to) pressing hiera 
into service in that effort.  For example, to fall back to hiera for 
otherwise-unmatched nodes, add something like this to site.pp:

node default {
  $classes = hiera('classes')
  # $classes could contain 'run_script' where appropriate
  include $classes
}


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to