Nicolas Arias
2008-Mar-28 13:12 UTC
[Puppet Users] Question about service subscribe and line editing.
Hello guys, sorry if this is basic, but i cant find a answer. i have the following code: # services/syslog.pp import "../utils.pp" class syslog { file{"/etc/syslog.conf": ensure => present} line{ redir_logs: file => "/etc/syslog.conf", line => ''*.* @ syslog.domain.com''; } service { syslog: ensure => running, subscribe => File["/etc/syslog.conf"] } } Im using the "Simple text edit" recipe. I can see that the line is added, but the service is not restarted. How does suscribe work?, if i replace completely the file, it restarts, but not if i edit a line. Is there workaround?, this is my 3rd day with puppet, so im on the first phase of the learning curve, but im moving forward! cheers! -- -------> Dive to Live, Live to Dive <------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ashley Penney
2008-Mar-28 13:16 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
While this probably isn''t what you want, exactly, you might want to look into ''templates''. Where possible it''s always cleaner to write a template for something like syslog.conf, and have that generated for each node, than to try and replace lines within it! On Fri, Mar 28, 2008 at 9:12 AM, Nicolas Arias <nicoarias@gmail.com> wrote:> Hello guys, sorry if this is basic, but i cant find a answer. > > > i have the following code: > > # services/syslog.pp > import "../utils.pp" > > class syslog { > > file{"/etc/syslog.conf": ensure => present} > line{ redir_logs: > file => "/etc/syslog.conf", > line => ''*.* @ syslog.domain.com''; > } > service { syslog: > ensure => running, > subscribe => File["/etc/syslog.conf"] > } > > } > > > Im using the "Simple text edit" recipe. > > I can see that the line is added, but the service is not restarted. How > does suscribe work?, if i replace completely the file, it restarts, but not > if i edit a line. Is there workaround?, this is my 3rd day with puppet, so > im on the first phase of the learning curve, but im moving forward! > > > cheers! > -- > -------> Dive to Live, Live to Dive <------- > > >--~--~---------~--~----~------------~-------~--~----~ 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 Arias
2008-Mar-28 13:20 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
mmm, templates?, ill have to google about that, cheers! On Fri, Mar 28, 2008 at 10:16 AM, Ashley Penney <apenney@gmail.com> wrote:> While this probably isn''t what you want, exactly, you might want to look > into ''templates''. Where possible it''s always cleaner to write a template > for something like syslog.conf, and have that generated for each node, > than to try and replace lines within it! > > > On Fri, Mar 28, 2008 at 9:12 AM, Nicolas Arias <nicoarias@gmail.com> > wrote: > > > Hello guys, sorry if this is basic, but i cant find a answer. > > > > > > i have the following code: > > > > # services/syslog.pp > > import "../utils.pp" > > > > class syslog { > > > > file{"/etc/syslog.conf": ensure => present} > > line{ redir_logs: > > file => "/etc/syslog.conf", > > line => ''*.* @ syslog.domain.com''; > > } > > service { syslog: > > ensure => running, > > subscribe => File["/etc/syslog.conf"] > > } > > > > } > > > > > > Im using the "Simple text edit" recipe. > > > > I can see that the line is added, but the service is not restarted. How > > does suscribe work?, if i replace completely the file, it restarts, but not > > if i edit a line. Is there workaround?, this is my 3rd day with puppet, so > > im on the first phase of the learning curve, but im moving forward! > > > > > > cheers! > > -- > > -------> Dive to Live, Live to Dive <------- > > > > > > > >-- -------> Dive to Live, Live to Dive <------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ashley Penney
2008-Mar-28 13:23 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
http://reductivelabs.com/trac/puppet/wiki/PuppetTemplating That should have all the basics to get going, this is how I generate things like my ifcfg-eth0 scripts per box, and sudoers. :) On Fri, Mar 28, 2008 at 9:20 AM, Nicolas Arias <nicoarias@gmail.com> wrote:> mmm, templates?, ill have to google about that, cheers! > > > On Fri, Mar 28, 2008 at 10:16 AM, Ashley Penney <apenney@gmail.com> wrote: > > > While this probably isn''t what you want, exactly, you might want to look > > into ''templates''. Where possible it''s always cleaner to write a template > > for something like syslog.conf, and have that generated for each node, > > than to try and replace lines within it! > > > > > > On Fri, Mar 28, 2008 at 9:12 AM, Nicolas Arias <nicoarias@gmail.com> > > wrote: > > > > > Hello guys, sorry if this is basic, but i cant find a answer. > > > > > > > > > i have the following code: > > > > > > # services/syslog.pp > > > import "../utils.pp" > > > > > > class syslog { > > > > > > file{"/etc/syslog.conf": ensure => present} > > > line{ redir_logs: > > > file => "/etc/syslog.conf", > > > line => ''*.* @ syslog.domain.com''; > > > } > > > service { syslog: > > > ensure => running, > > > subscribe => File["/etc/syslog.conf"] > > > } > > > > > > } > > > > > > > > > Im using the "Simple text edit" recipe. > > > > > > I can see that the line is added, but the service is not restarted. > > > How does suscribe work?, if i replace completely the file, it restarts, but > > > not if i edit a line. Is there workaround?, this is my 3rd day with puppet, > > > so im on the first phase of the learning curve, but im moving forward! > > > > > > > > > cheers! > > > -- > > > -------> Dive to Live, Live to Dive <------- > > > > > > > > > > > > > > > -- > -------> Dive to Live, Live to Dive <------- > > >--~--~---------~--~----~------------~-------~--~----~ 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 Arias
2008-Mar-28 13:28 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
cheers Ashley!!!! On Fri, Mar 28, 2008 at 10:23 AM, Ashley Penney <apenney@gmail.com> wrote:> http://reductivelabs.com/trac/puppet/wiki/PuppetTemplating > That should have all the basics to get going, this is how I generate > things like my ifcfg-eth0 scripts per box, and sudoers. :) > > > On Fri, Mar 28, 2008 at 9:20 AM, Nicolas Arias <nicoarias@gmail.com> > wrote: > > > mmm, templates?, ill have to google about that, cheers! > > > > > > On Fri, Mar 28, 2008 at 10:16 AM, Ashley Penney <apenney@gmail.com> > > wrote: > > > > > While this probably isn''t what you want, exactly, you might want to > > > look into ''templates''. Where possible it''s always cleaner to write a > > > template for something like syslog.conf, and have that generated for > > > each node, than to try and replace lines within it! > > > > > > > > > On Fri, Mar 28, 2008 at 9:12 AM, Nicolas Arias <nicoarias@gmail.com> > > > wrote: > > > > > > > Hello guys, sorry if this is basic, but i cant find a answer. > > > > > > > > > > > > i have the following code: > > > > > > > > # services/syslog.pp > > > > import "../utils.pp" > > > > > > > > class syslog { > > > > > > > > file{"/etc/syslog.conf": ensure => present} > > > > line{ redir_logs: > > > > file => "/etc/syslog.conf", > > > > line => ''*.* @ syslog.domain.com''; > > > > } > > > > service { syslog: > > > > ensure => running, > > > > subscribe => File["/etc/syslog.conf"] > > > > } > > > > > > > > } > > > > > > > > > > > > Im using the "Simple text edit" recipe. > > > > > > > > I can see that the line is added, but the service is not restarted. > > > > How does suscribe work?, if i replace completely the file, it restarts, but > > > > not if i edit a line. Is there workaround?, this is my 3rd day with puppet, > > > > so im on the first phase of the learning curve, but im moving forward! > > > > > > > > > > > > cheers! > > > > -- > > > > -------> Dive to Live, Live to Dive <------- > > > > > > > > > > > > > > > > > > > > > > > -- > > -------> Dive to Live, Live to Dive <------- > > > > > > > >-- -------> Dive to Live, Live to Dive <------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Evan Hisey
2008-Mar-28 15:41 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
Nicholas- Yeah that learning curve can be right pain. I am on about week 4. th language is easy enough but there are some many way so to but it to gether. On Fri, Mar 28, 2008 at 8:12 AM, Nicolas Arias <nicoarias@gmail.com> wrote:> Hello guys, sorry if this is basic, but i cant find a answer. > > > i have the following code: > > # services/syslog.pp > import "../utils.pp" > > class syslog { > > file{"/etc/syslog.conf": ensure => present}What you need is to add checksum =>md5 ( I use md5 there a few other choices). so that file checks not only that it is there but also that the contents match.> line{ redir_logs: > file => "/etc/syslog.conf", > line => ''*.* @ syslog.domain.com''; > } > service { syslog: > ensure => running, > subscribe => File["/etc/syslog.conf"] > } > > } > > > Im using the "Simple text edit" recipe.The template suggestion may be smarter. I have not gotten that far yet on my learning curve. Evan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Schmitt
2008-Mar-29 18:00 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 28 March 2008, Nicolas Arias wrote:> Hello guys, sorry if this is basic, but i cant find a answer. > > > i have the following code: > > # services/syslog.pp > import "../utils.pp" > > class syslog { > > file{"/etc/syslog.conf": ensure => present} > line{ redir_logs: > file => "/etc/syslog.conf", > line => ''*.* @ syslog.domain.com''; > } > service { syslog: > ensure => running, > subscribe => File["/etc/syslog.conf"] > } > > } > > > Im using the "Simple text edit" recipe. > > I can see that the line is added, but the service is not restarted. How > does suscribe work?, if i replace completely the file, it restarts, but not > if i edit a line. Is there workaround?, this is my 3rd day with puppet, so > im on the first phase of the learning curve, but im moving forward!As Ashley said, templates are probably a better fit in this particular case. To answer you question generally though: You have to set "checksum => md5" on the file, else puppet will not note the changed file. Regards, DavidS - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH7oO2/Pp1N6Uzh0URAvpYAJ40YQ5IJPRjYYoxlSOgq70bfnr+PwCfVuyn gl5GP36UclvNIYWi6iVvcKM=+TA/ -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 Arias
2008-Mar-29 20:03 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
Thanks DavidS, ill check the template thing (i dont really see how can it make my life easy in this manifest, but ill give it a try) cheers! On Sat, Mar 29, 2008 at 3:00 PM, David Schmitt <david@schmitt.edv-bus.at> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Friday 28 March 2008, Nicolas Arias wrote: > > Hello guys, sorry if this is basic, but i cant find a answer. > > > > > > i have the following code: > > > > # services/syslog.pp > > import "../utils.pp" > > > > class syslog { > > > > file{"/etc/syslog.conf": ensure => present} > > line{ redir_logs: > > file => "/etc/syslog.conf", > > line => ''*.* @ syslog.domain.com''; > > } > > service { syslog: > > ensure => running, > > subscribe => File["/etc/syslog.conf"] > > } > > > > } > > > > > > Im using the "Simple text edit" recipe. > > > > I can see that the line is added, but the service is not restarted. How > > does suscribe work?, if i replace completely the file, it restarts, but > not > > if i edit a line. Is there workaround?, this is my 3rd day with puppet, > so > > im on the first phase of the learning curve, but im moving forward! > > As Ashley said, templates are probably a better fit in this particular > case. > To answer you question generally though: > > You have to set "checksum => md5" on the file, else puppet will not note > the > changed file. > > > Regards, DavidS > > > > - -- > The primary freedom of open source is not the freedom from cost, but the > free- > dom to shape software to do what you want. This freedom is /never/ > exercised > without cost, but is available /at all/ only by accepting the very > different > costs associated with open source, costs not in money, but in time and > effort. > - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking<http://www.schierer.org/%7Eluke/log/20070710-1129/on-forks-and-forking> > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFH7oO2/Pp1N6Uzh0URAvpYAJ40YQ5IJPRjYYoxlSOgq70bfnr+PwCfVuyn > gl5GP36UclvNIYWi6iVvcKM> =+TA/ > -----END PGP SIGNATURE----- > > > >-- -------> Dive to Live, Live to Dive <------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Schmitt
2008-Mar-30 08:27 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday 29 March 2008, Nicolas Arias wrote:> Thanks DavidS, ill check the template thing (i dont really see how can it > make my life easy in this manifest, but ill give it a try)Usually "line" is only for files which are regularily modified by processes outside of puppet''s control. Files like syslog.conf should be managed completely by puppet though. This enables you to just say it like this: file { "/etc/syslog.conf": mode => 0644, owner => root, group => root, content => "*.* @mysyslogserver\n" } This would also disable (presumably) unneeded local logs and make subscribe work without needing to checksum the file. Using templates you can expand on this, by saying content => template ("mysyslog.conf") where you can have arbitrary text and ruby code to create complex syslog configs. Regards, DavidS - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH707v/Pp1N6Uzh0URAmhRAJ9CP8CJc3++pZpdJIIrGnfOwMl5cACgo7vB CNSw/B2ap1D5kc95incnvJw=+8u2 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 Arias
2008-Mar-30 13:20 UTC
[Puppet Users] Re: Question about service subscribe and line editing.
Cheerds DavidS, now im starting to see the light on the end of the tunnel. Cheers! On Sun, Mar 30, 2008 at 5:27 AM, David Schmitt <david@schmitt.edv-bus.at> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Saturday 29 March 2008, Nicolas Arias wrote: > > Thanks DavidS, ill check the template thing (i dont really see how can > it > > make my life easy in this manifest, but ill give it a try) > > Usually "line" is only for files which are regularily modified by > processes > outside of puppet''s control. Files like syslog.conf should be managed > completely by puppet though. This enables you to just say it like this: > > file { "/etc/syslog.conf": > mode => 0644, owner => root, group => root, > content => "*.* @mysyslogserver\n" > } > > This would also disable (presumably) unneeded local logs and make > subscribe > work without needing to checksum the file. > > > Using templates you can expand on this, by saying > > content => template ("mysyslog.conf") > > where you can have arbitrary text and ruby code to create complex syslog > configs. > > > > Regards, DavidS > - -- > The primary freedom of open source is not the freedom from cost, but the > free- > dom to shape software to do what you want. This freedom is /never/ > exercised > without cost, but is available /at all/ only by accepting the very > different > costs associated with open source, costs not in money, but in time and > effort. > - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking<http://www.schierer.org/%7Eluke/log/20070710-1129/on-forks-and-forking> > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFH707v/Pp1N6Uzh0URAmhRAJ9CP8CJc3++pZpdJIIrGnfOwMl5cACgo7vB > CNSw/B2ap1D5kc95incnvJw> =+8u2 > -----END PGP SIGNATURE----- > > > >-- -------> Dive to Live, Live to Dive <------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---