Mohamed Lrhazi
2011-Jan-27 16:26 UTC
[Puppet Users] How to deal with a slightly changing file?
I have a file that is part of a software I am installing via puppet... the file is constructed from a template, as it has a couple of fields I wanna be able to change in the future. The file is updated by the app itself, upon restart, which changes just one field, in a key=val line...the result is that puppet rebuilds the file, and becuase of depnedecy, restarts the app at each run. Can I somehow say ignore that one line? file { "splunk_outputs": owner => splunk, group => splunk, mode => 644, require => [Package["splunk"]], path => "/opt/splunk/etc/system/local/outputs.conf", content => template("gu_splunk/outputs.conf.erb"), #but please ignore line starting with: sslPassword notify => Exec["restart"], } Thanks a lot. Mohamed. -- 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.
Brian Gallew
2011-Jan-27 16:57 UTC
Re: [Puppet Users] How to deal with a slightly changing file?
Not really. There are a couple ways to handle this: 1) Make use of includes. Have the puppet-managed file include the app-managed file. Of course, this requires the app to be friendly to this kind of setup. 2) Add "replace=>false" so that Puppet will create the file but never update it if it exists. Of course, that breaks when you have updates that you really do need puppet to apply. 3) Install/use augeas. You''ll probably need to write an appropriate lens, but if done correctly, this is very robust. 4) Use an exec to modify the file in-place. This is fugly. 5) Use an exec with the application''s CLI to to have the application make the updates. Better than 4, but still not exactly beautiful. On Jan 27, 2011, at 8:26 AM, Mohamed Lrhazi wrote:> I have a file that is part of a software I am installing via puppet... > the file is constructed from a template, as it has a couple of fields > I wanna be able to change in the future. > The file is updated by the app itself, upon restart, which changes > just one field, in a key=val line...the result is that puppet rebuilds > the file, and becuase of depnedecy, restarts the app at each run. > > Can I somehow say ignore that one line? > > file { "splunk_outputs": > owner => splunk, > group => splunk, > mode => 644, > require => [Package["splunk"]], > path => "/opt/splunk/etc/system/local/outputs.conf", > content => template("gu_splunk/outputs.conf.erb"), #but please > ignore line starting with: sslPassword> notify => Exec["restart"], > } > > Thanks a lot. > Mohamed. > > -- > 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. >-- 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.
Brian Gallew
2011-Jan-27 17:00 UTC
Re: [Puppet Users] How to deal with a slightly changing file?
Not really. There are a couple ways to handle this: 1) Make use of includes. Have the puppet-managed file include the app-managed file. Of course, this requires the app to be friendly to this kind of setup. 2) Add "replace=>false" so that Puppet will create the file but never update it if it exists. Of course, that breaks when you have updates that you really do need puppet to apply. 3) Install/use augeas. You''ll probably need to write an appropriate lens, but if done correctly, this is very robust. 4) Use an exec to modify the file in-place. This is fugly. 5) Use an exec with the application''s CLI to to have the application make the updates. Better than 4, but still not exactly beautiful. On Jan 27, 2011, at 8:26 AM, Mohamed Lrhazi wrote:> I have a file that is part of a software I am installing via puppet... > the file is constructed from a template, as it has a couple of fields > I wanna be able to change in the future. > The file is updated by the app itself, upon restart, which changes > just one field, in a key=val line...the result is that puppet rebuilds > the file, and becuase of depnedecy, restarts the app at each run. > > Can I somehow say ignore that one line? > > file { "splunk_outputs": > owner => splunk, > group => splunk, > mode => 644, > require => [Package["splunk"]], > path => "/opt/splunk/etc/system/local/outputs.conf", > content => template("gu_splunk/outputs.conf.erb"), #but please > ignore line starting with: sslPassword> notify => Exec["restart"], > } > > Thanks a lot. > Mohamed. > > -- > 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. >-- 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.
Mohamed Lrhazi
2011-Jan-27 18:34 UTC
Re: [Puppet Users] How to deal with a slightly changing file?
Thanks Brian... Looks like 2 and 3 are my options.... 2) Add "replace=>false" so that Puppet will create the file but never update it if it exists. Of course, that breaks when you have updates that you really do need puppet to apply. When I need to force the update, I would simply comment out the ''replace" for one run? is there a better way? Mohamed. On Thu, Jan 27, 2011 at 12:00 PM, Brian Gallew <geek@gallew.org> wrote:> Not really. There are a couple ways to handle this: > 1) Make use of includes. Have the puppet-managed file include the app-managed file. Of course, this requires the app to be friendly to this kind of setup. > 2) Add "replace=>false" so that Puppet will create the file but never update it if it exists. Of course, that breaks when you have updates that you really do need puppet to apply. > 3) Install/use augeas. You''ll probably need to write an appropriate lens, but if done correctly, this is very robust. > 4) Use an exec to modify the file in-place. This is fugly. > 5) Use an exec with the application''s CLI to to have the application make the updates. Better than 4, but still not exactly beautiful. > > On Jan 27, 2011, at 8:26 AM, Mohamed Lrhazi wrote: > >> I have a file that is part of a software I am installing via puppet... >> the file is constructed from a template, as it has a couple of fields >> I wanna be able to change in the future. >> The file is updated by the app itself, upon restart, which changes >> just one field, in a key=val line...the result is that puppet rebuilds >> the file, and becuase of depnedecy, restarts the app at each run. >> >> Can I somehow say ignore that one line? >> >> file { "splunk_outputs": >> owner => splunk, >> group => splunk, >> mode => 644, >> require => [Package["splunk"]], >> path => "/opt/splunk/etc/system/local/outputs.conf", >> content => template("gu_splunk/outputs.conf.erb"), #but please >> ignore line starting with: sslPassword>> notify => Exec["restart"], >> } >> >> Thanks a lot. >> Mohamed. >> >> -- >> 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. >> > > -- > 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. > >-- 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.
Brian Gallew
2011-Jan-27 19:40 UTC
Re: [Puppet Users] How to deal with a slightly changing file?
Either comment it out for the one run or delete the target file manually. Neither solution is really good. On Jan 27, 2011, at 10:34 AM, Mohamed Lrhazi wrote:> Thanks Brian... > Looks like 2 and 3 are my options.... > > 2) Add "replace=>false" so that Puppet will create the file but never > update it if it exists. Of course, that breaks when you have updates > that you really do need puppet to apply. > > When I need to force the update, I would simply comment out the > ''replace" for one run? is there a better way? > > Mohamed. > > > > On Thu, Jan 27, 2011 at 12:00 PM, Brian Gallew <geek@gallew.org> wrote: >> Not really. There are a couple ways to handle this: >> 1) Make use of includes. Have the puppet-managed file include the app-managed file. Of course, this requires the app to be friendly to this kind of setup. >> 2) Add "replace=>false" so that Puppet will create the file but never update it if it exists. Of course, that breaks when you have updates that you really do need puppet to apply. >> 3) Install/use augeas. You''ll probably need to write an appropriate lens, but if done correctly, this is very robust. >> 4) Use an exec to modify the file in-place. This is fugly. >> 5) Use an exec with the application''s CLI to to have the application make the updates. Better than 4, but still not exactly beautiful. >> >> On Jan 27, 2011, at 8:26 AM, Mohamed Lrhazi wrote: >> >>> I have a file that is part of a software I am installing via puppet... >>> the file is constructed from a template, as it has a couple of fields >>> I wanna be able to change in the future. >>> The file is updated by the app itself, upon restart, which changes >>> just one field, in a key=val line...the result is that puppet rebuilds >>> the file, and becuase of depnedecy, restarts the app at each run. >>> >>> Can I somehow say ignore that one line? >>> >>> file { "splunk_outputs": >>> owner => splunk, >>> group => splunk, >>> mode => 644, >>> require => [Package["splunk"]], >>> path => "/opt/splunk/etc/system/local/outputs.conf", >>> content => template("gu_splunk/outputs.conf.erb"), #but please >>> ignore line starting with: sslPassword>>> notify => Exec["restart"], >>> } >>> >>> Thanks a lot. >>> Mohamed. >>> >>> -- >>> 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. >>> >> >> -- >> 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. >> >> > > -- > 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. >-- 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.