On Tuesday, July 7, 2015 at 5:22:45 AM UTC-5, Andreas Dvorak wrote: > > Hello, > > I have a module to copy files /etc/hostname.* in Solaris. But the > interface name can be any. > > e.g. > networking/file/vm6742/hostname.e1000g0 > networking/file/vm6742/hostname.e1000g1 > > I do not want to user file with recurse because the files in /etc have > different permissions. > > Is it possible to get a file list of the source to use that in the file > resource or is there an other solution? > > You can use Puppet's generate() function to get a listing of the files on the master, and manipulate the result into on File resource for each of the source files. Probably the built-in split() function will be useful for that, and perhaps also regsubst(). Alternatively, you could package some or all of that into a custom function.
You might also find it to your advantage to wrap up the per-file details in a defined type, which you can instantiate with an array title derived from your file list: mymodule::hostname_file { $filenames: } Or I guess the newfangled way to go about it would involve the each() function (Puppet 4 or future parser only). 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/903b0c66-f36b-4a8e-8c45-879d16971add%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.