The company I work for is getting ready to deploy a large puppet configuration into an existing environment. The majority of the servers that this will be deployed on are web servers, however some of them are configured different from the rest. We have a set of default config files for apache, mysql and so forth, however my quesiton is: Is there a way to "tell" puppet to do a sort of comparison on the files, so that if one does not match the default config it is ignored and or not replaced with the default. Any help with this is greatly appreciated, Thanks ahead of time. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If there is no default config file, you want to put a default config file in place, but otherwise, leave it alone? If so, one way to do it would be to use "unless" or "onlyif" in your recipe. Something like this should work (untested by me), although there may be a "better" way to do it: file { "/etc/httpd/conf/httpd.conf": ensure => file, owner => root, group => root, mode => 0644, content => template("/var/lib/puppet/files/httpd.conf"), notify => Service[httpd], unless => "ls /etc/httpd/conf/httpd.conf" } On Wed, Jul 1, 2009 at 10:47 AM, Tim Galyean <tim.galyean@gmail.com> wrote:> > The company I work for is getting ready to deploy a large puppet > configuration into an existing environment. The majority of the > servers that this will be deployed on are web servers, however some of > them are configured different from the rest. > > We have a set of default config files for apache, mysql and so forth, > however my quesiton is: > > Is there a way to "tell" puppet to do a sort of comparison on the > files, so that if one does not match the default config it is ignored > and or not replaced with the default. > > Any help with this is greatly appreciated, Thanks ahead of time. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tim Galyean wrote:> The company I work for is getting ready to deploy a large puppet > configuration into an existing environment. The majority of the > servers that this will be deployed on are web servers, however some of > them are configured different from the rest. > > We have a set of default config files for apache, mysql and so forth, > however my quesiton is: > > Is there a way to "tell" puppet to do a sort of comparison on the > files, so that if one does not match the default config it is ignored > and or not replaced with the default. > > Any help with this is greatly appreciated, Thanks ahead of time.Set the "replace" parameter on the file to false. This will keep puppet from overwriting local changes. If you want to see what is different from what it should be, use --noop when running puppetd instead. Regards, DavidS --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Thu, Jul 2, 2009 at 6:57 AM, David Schmitt <david@dasz.at> wrote:> > Tim Galyean wrote: > > The company I work for is getting ready to deploy a large puppet > > configuration into an existing environment. The majority of the > > servers that this will be deployed on are web servers, however some of > > them are configured different from the rest. > > > > We have a set of default config files for apache, mysql and so forth, > > however my quesiton is: > > > > Is there a way to "tell" puppet to do a sort of comparison on the > > files, so that if one does not match the default config it is ignored > > and or not replaced with the default. > > > > Any help with this is greatly appreciated, Thanks ahead of time. > > > Set the "replace" parameter on the file to false. This will keep puppet > from overwriting local changes. > > If you want to see what is different from what it should be, use --noop > when running puppetd instead. > > > Regards, DavidSBear in mind that "replace" only looks at whether the file exists, not the actual contents. What is the OP actually trying to accomplish? From the original email, it sounds like he''s trying to replace a file if and only if it is identical to the new one. The easiest solution to that: don''t define the file in Puppet. That way, all of them will remain exactly as they are... -SH --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Wed, Jul 1, 2009 at 10:47 AM, Tim Galyean<tim.galyean@gmail.com> wrote:> > Is there a way to "tell" puppet to do a sort of comparison on the > files, so that if one does not match the default config it is ignored > and or not replaced with the default.A portion of my autofs class: class autofs { package { autofs: ensure => installed } # Only update /etc/auto.master if it doesn''t exist, or if it has the same # contents as the original package install. Ie. do not overwrite user changes # to the file. # Compute the sha hash of the current file, and the original template, to see if # the file has changed. It it has, set "replace" to no. /dev/null is used to # prevent exceptions when the files don''t exist (if /dev/null doesn''t exist, we # can assume we are f$cked) $tmp_a = sha1(file("/etc/auto.master", "/dev/null")) $tmp_b = sha1(file("/usr/share/autofs/conffiles/auto.master", "/dev/null")) if $tmp_a == $tmp_b { $replace_master = yes } else { $replace_master = no } rootfile { "/etc/auto.master": replace => $replace_master, source => "autofs/auto.master" } } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Agreed; the simple answer is to not manage the file. Assuming that the default configurations will be in place already from the apache, mysql, etc., installs; and the OP does not want to replace custom files -- not managing the file is the simple solution. On Jul 2, 9:20 am, S H <shdashb...@gmail.com> wrote:> On Thu, Jul 2, 2009 at 6:57 AM, David Schmitt <da...@dasz.at> wrote: > > > Tim Galyean wrote: > > > The company I work for is getting ready to deploy a large puppet > > > configuration into an existing environment. The majority of the > > > servers that this will be deployed on are web servers, however some of > > > them are configured different from the rest. > > > > We have a set of default config files for apache, mysql and so forth, > > > however my quesiton is: > > > > Is there a way to "tell" puppet to do a sort of comparison on the > > > files, so that if one does not match the default config it is ignored > > > and or not replaced with the default. > > > > Any help with this is greatly appreciated, Thanks ahead of time. > > > Set the "replace" parameter on the file to false. This will keep puppet > > from overwriting local changes. > > > If you want to see what is different from what it should be, use --noop > > when running puppetd instead. > > > Regards, DavidS > > Bear in mind that "replace" only looks at whether the file exists, not the > actual contents. > > What is the OP actually trying to accomplish? From the original email, it > sounds like he''s trying to replace a file if and only if it is identical to > the new one. The easiest solution to that: don''t define the file in Puppet. > That way, all of them will remain exactly as they are... > > -SH- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---