> I believe most people are bound to write this define sooner or later: > > define my_file() { > file { "$name": > source => "puppet:///files/$name", > > } > > It's a bit trickier to add support for all of file's options, but once > that's in, it's a huge advantage.
I use a similar define I shamelessly copied from someone else. Pasted below in case it benefits others: #Copy a file from the Puppet master. # #A good idea sourced from http://narrabilis.com/mybook/puppet/functions.pp #Basically it's a little wrapper for the file type that's used to copy #a file from the puppet master. 'module' and 'path' are the only required #parameters. # #PARAMETERS: # - path The path to the source file to copy as relative to modules/<module name>/files/. # - module The name of the module to copy the file from. # - mode Parameter passed directly to File type. # - owner Parameter passed directly to File type. # - group Parameter passed directly to File type. # - ensure Parameter passed directly to File type. define remotefile($path, $module, $owner = root, $group = root, $mode = 0644, $ensure = present) { file { $name: ensure => $ensure, mode => $mode, owner => $owner, group => $group, source => "puppet:///modules/$module/$path", } } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.