On Oct 11, 2008, at 11:46 AM, Joel Nimety wrote: > > I'm using the SimpleText recipe and Augeas plugin to modify files in > place. I'd like to notify the appropriate File resource that a > modification is about to take place so puppet can backup the file. > Maybe > this is already possible but I haven't found any examples or > documentation on how to accomplish this. I think a natural way to do > this would be to use the subscribe or notify parameters, something > like > this. > > class sshd { > package { "openssh-server": ensure => installed } > > file { "sshd_config": > name => $operatingsystem ? { > default => "/etc/ssh/sshd_config" > }, > } > > service { "sshd": > name => $operatingsystem ? { > default => sshd > }, > hasrestart => true, > hasstatus => true, > ensure => running, > subscribe => [Package["openssh-server"], File["sshd_config"]] > } > > augeas { > "sshd_config_port" : > notify => [ Service["sshd"], File["sshd_config"] ] > context => "/files/etc/ssh/sshd_config", > changes => "set Port 22", > onlyif => "get Port != 22", > } > }
The problem with this is that by the time the 'file' resource has gotten the 'notify' message, the file's already been changed so it's too late to back it up. You'd either need your type to somehow track the files it's going to change and back them up (which is what the ParsedFile types do), or you'd need Puppet, as a whole, to keep track of files that *might* change, back them up preemptively, and then remove any backups that aren't needed. Or something like that. Either way, this isn't easy. -- I went to a restaurant that serves "breakfast at anytime". So I ordered French Toast during the Renaissance. -- Stephen Wright --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---