Douglas Land
2008-Apr-04 16:12 UTC
[Puppet Users] Issues with mirroring directories with puppet
It''s my understanding that if a file exists under a directory on the puppet client but doesn''t exist under directory on the puppet server server and puppet manages that directory on the client, that it won''t delete that file on the client. I''m trying to keep certain directories synchronized with the puppet server,. It seems that the standard file operations don''t actually do this, but only keep files synchronized. I found references to purging directories in this case vai two options. I''ve seen, referencing an empty directory, a la: file { "/opt/puppet": owner => root, group => root, purge => true, recurse => true, force => true, source => "/dev/null/nuller" } However if I already have a source, this isn''t an option. and I''ve also heard the "less elegant" approach of calling exec rm, but I''ve tried this too, and it seems that ordering isn''t guaranteed in puppet, so sometimes rm would run when it was supposed to, but sometimes it would, for instance, run in the middle of the copy and completely destroy the whole process. It''s entirely possible I''m missing something simple. Any help would be greatly appreciated. Thanks! -- No, I''m not a narcissist, and I don''t even know what that means. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Paul Lathrop
2008-Apr-04 18:17 UTC
[Puppet Users] Re: Issues with mirroring directories with puppet
I haven''t tried it myself, but I think purge does actually work the way you''d like it to; i.e. if there are files there that Puppet didn''t put there, it will remove them. I''m not 100% sure of that. However, the rm problem is easy - make your file {} resource depend on the exec {} resource you set up to clear the directory. Then ordering is guaranteed. --Paul On Fri, Apr 4, 2008 at 9:12 AM, Douglas Land <technopathology@gmail.com> wrote:> > It''s my understanding that if a file exists under a directory on the > puppet client but doesn''t exist under directory on the puppet server > server and puppet manages that directory on the client, that it won''t > delete that file on the client. > > I''m trying to keep certain directories synchronized with the puppet > server,. It seems that the standard file operations don''t actually do > this, but only keep files synchronized. I found references to purging > directories in this case vai two options. > > I''ve seen, referencing an empty directory, a la: > > file { "/opt/puppet": > owner => root, > group => root, > purge => true, > recurse => true, > force => true, > source => "/dev/null/nuller" > } > > However if I already have a source, this isn''t an option. > > and I''ve also heard the "less elegant" approach of calling exec rm, > but I''ve tried this too, and it seems that ordering isn''t guaranteed > in puppet, so sometimes rm would run when it was supposed to, but > sometimes it would, for instance, run in the middle of the copy and > completely destroy the whole process. > > It''s entirely possible I''m missing something simple. Any help would be > greatly appreciated. > > Thanks! > > -- > No, I''m not a narcissist, and I don''t even know what that means. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike Renfro
2008-Apr-04 19:00 UTC
[Puppet Users] Re: Issues with mirroring directories with puppet
On 4/4/2008 11:12 AM, Douglas Land wrote:> I''m trying to keep certain directories synchronized with the puppet > server,. It seems that the standard file operations don''t actually do > this, but only keep files synchronized. I found references to purging > directories in this case vai two options.Untested, but something like this may work (I use something similar to distribute packages made for GNU stow): exec { "syncit": command => "/usr/bin/rsync -a --delete host::module /opt/puppet", refreshonly => true, subscribe => File["sync-initiator"], } file { "sync-initiator": source => "puppet:///files/sync-initiator", path => "/etc/puppet/sync-initiator", } Then whenever you make changes to the source folder on the server (the one pointed at by ::module), you manually timestamp sync-initiator with something like "date > /etc/puppet/files/sync-initiator". Puppet clients should then resync themselves on their next checkin. -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Douglas Land
2008-Apr-04 22:15 UTC
[Puppet Users] Re: Issues with mirroring directories with puppet
Thanks so much both of you. I ended up doing the dependencies for now. I get my pulling strings book on the 9th so I can see what I did wrong. :) On Fri, Apr 4, 2008 at 12:00 PM, Mike Renfro <renfro@tntech.edu> wrote:> > On 4/4/2008 11:12 AM, Douglas Land wrote: > > > I''m trying to keep certain directories synchronized with the puppet > > server,. It seems that the standard file operations don''t actually do > > this, but only keep files synchronized. I found references to purging > > directories in this case vai two options. > > Untested, but something like this may work (I use something similar to > distribute packages made for GNU stow): > > exec { "syncit": > command => "/usr/bin/rsync -a --delete host::module /opt/puppet", > refreshonly => true, > subscribe => File["sync-initiator"], > } > > file { "sync-initiator": > source => "puppet:///files/sync-initiator", > path => "/etc/puppet/sync-initiator", > } > > Then whenever you make changes to the source folder on the server (the > one pointed at by ::module), you manually timestamp sync-initiator with > something like "date > /etc/puppet/files/sync-initiator". Puppet clients > should then resync themselves on their next checkin. > > -- > Mike Renfro / R&D Engineer, Center for Manufacturing Research, > 931 372-3601 / Tennessee Technological University > > > > > >-- No, I''m not a narcissist, and I don''t even know what that means. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---