I want to be able to have Puppet determine which file to use as the
source of a template() call in a manner similar to the source
parameter.

Basically, I want to have a file resource that will use the most
appropriate file for a template. While I can do:

file { "file.conf" :
         source => [ "puppet:///module/file.conf.${hostname}",
                            "puppet://module/file.conf.${groupname}",
                            "puppet:///module/file.conf"],
}

I cannot do:

 file { "file.conf" :
          content => [ template("module/file.conf.${hostname}"),
                              template("module/file.conf.$
{groupname}"),
                              template("module/file.conf")]
 }

This fails in 0.25.5 if the first file for the template call does not
exist.

I know I can use a case statement or selector to set a variable name,
but that won't do what I want. Basically, I want puppet to use the
first file it finds for the source of the template() call, just like
the source version.

For some nodes, or some groups, there will be such a file, and in
other cases, the default file will be used.

Anyone know how to do this? The alternative would be to have some way
to test if the file exists in the paths. Anyone know how to do that?
This isn't a test to see if the file exists on the client, but in the
puppet repo, so in client/server mode, this would be testing if the
file exists on the server.

Any suggestions are greatly appreciated.

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

Reply via email to