Hello All! I would like to automatically add a header to all files/templates that puppet manages on my servers. Something like "#if you break, my puppet will fix it!!" Is this possible? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Nicolas Szalay
2009-Aug-06 07:03 UTC
[Puppet Users] Re: How to add header to all files/templates?
Le mercredi 05 août 2009 à 22:53 -0700, robbyt a écrit :> Hello All! > > I would like to automatically add a header to all files/templates that > puppet manages on my servers. Something like "#if you break, my puppet > will fix it!!" > > Is this possible?Probably by creating a custom type that would works like header_file { "/etc/myapp/myfile": owner => blah group => xxxx source => "puppet://files/app/myapp/myfile" } the original "myfile" not having header of course. See http://reductivelabs.com/trac/puppet/wiki/PracticalTypes that gives an example of custom type. Moreover, the example looks like what you want to do. Regards, Nico.
Sam Rowe
2009-Aug-06 12:57 UTC
[Puppet Users] Re: How to add header to all files/templates?
On Thu, Aug 6, 2009 at 1:53 AM, robbyt<robbyt@robbyt.net> wrote:> > Hello All! > > I would like to automatically add a header to all files/templates that > puppet manages on my servers. Something like "#if you break, my puppet > will fix it!!" > > Is this possible?Not sure if this is the best way, but you could set a variable in your site.pp: $myheader = "whatever" I''m pretty sure the template will have access to that variable, but I''m not positive. Another route would be to create a custom parser function that sets the variable.... It''s simpler than it sounds. :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Ohad Levy
2009-Aug-06 13:51 UTC
[Puppet Users] Re: How to add header to all files/templates?
templates can accept a multiple list of erb files, therefor you could easly create a define that always include another template(header) for example (its up to you to test if it works ;)) define mytemplate($template) { file {$name: content => template("my header file",$template), } } and than you use it: mytemplate("/etc/motd": template => "my template", } hope it helps, Ohad On Thu, Aug 6, 2009 at 1:53 PM, robbyt <robbyt@robbyt.net> wrote:> > Hello All! > > I would like to automatically add a header to all files/templates that > puppet manages on my servers. Something like "#if you break, my puppet > will fix it!!" > > Is this possible? > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---