Clay
2012-Aug-28 21:20 UTC
[Puppet Users] using puppet augeas to add entry in /etc/syslog.conf
Hi , I"m trying to add a entry in /etc/syslog.conf using puppet augeas like this " *.warning;mail.none;authpriv.none;cron.none @syslog_host" , seems the way to do this with augeas is : augeas { "syslog_conf": lens => "syslog.lns", incl => "/etc/syslog.conf", changes => [ "ins entry after entry[last()]", "set entry[last()]/selector[1]/facility ''*''", "set entry[last()]/selector[1]/level warning", "set entry[last()]/selector[2]/facility mail", "set entry[last()]/selector[2]/level none", "set entry[last()]/selector[3]/facility authpriv", "set entry[last()]/selector[3]/level none", "set entry[last()]/selector[4]/facility cron", "set entry[last()]/selector[4]/level none", "set entry[last()]/action/hostname syslog_host", ], onlyif => "match entry[hostname = ''syslog_host''] size == 0", } which is a lot of entries just for one line of config file, also augeas has some problem on Solaris 10 to parse /etc/syslog.conf , it there a better way ? I know could use file server or template, but I''m just trying to add an entry to the existing syslog.conf file, rather than store them in puppet master. there''s a puppet module at https://github.com/mstrauss/puppet-editfile , which I haven''t tried yet. Is there a plan to add "editfile" feature to puppet , this is becoming rather frustrating . Thanks. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/YqXFiwuWtxQJ. 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.
Clay
2012-Aug-30 20:34 UTC
[Puppet Users] Re: using puppet augeas to add entry in /etc/syslog.conf
Hi , Any suggestions ? I may end up using a script to do this. Thanks. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/jBkVdaTrLmsJ. 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.
Peter Brown
2012-Aug-31 00:08 UTC
Re: [Puppet Users] Re: using puppet augeas to add entry in /etc/syslog.conf
I found a nice module on the puppet forge to do sysctl entries on RedHatish systems. https://forge.puppetlabs.com/fiddyspence/sysctl I worked wonderfully for what I needed. It sets the sysctl settings and optionally maked them permanent by adding an entry to /etc/sysctl.conf The best thing is if the value is set it doesn''t try to set it again. On 31 August 2012 06:34, Clay <clay.ye@gmail.com> wrote:> Hi , > Any suggestions ? I may end up using a script to do this. > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/jBkVdaTrLmsJ. > > 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.
Fiddyspence
2012-Aug-31 06:07 UTC
Re: [Puppet Users] Re: using puppet augeas to add entry in /etc/syslog.conf
Hey Pete Glad you find it useful! Cheers, Chris (fiddyspence) -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/gh8bq9uh3B8J. 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.
Erik Dalén
2012-Aug-31 07:28 UTC
Re: [Puppet Users] using puppet augeas to add entry in /etc/syslog.conf
If you know some ruby coding you could make a type and provider using either parsedfile or augeas like the augeasproviders: https://github.com/domcleal/augeasproviders You could possibly also use the file_line type from puppetlabs-stdlib. On 28 August 2012 23:20, Clay <clay.ye@gmail.com> wrote:> Hi , > I"m trying to add a entry in /etc/syslog.conf using puppet augeas like this > " *.warning;mail.none;authpriv.none;cron.none @syslog_host" > , > > seems the way to do this with augeas is : > > augeas { "syslog_conf": > lens => "syslog.lns", > incl => "/etc/syslog.conf", > changes => [ > "ins entry after entry[last()]", > "set entry[last()]/selector[1]/facility ''*''", > "set entry[last()]/selector[1]/level warning", > "set entry[last()]/selector[2]/facility mail", > "set entry[last()]/selector[2]/level none", > "set entry[last()]/selector[3]/facility authpriv", > "set entry[last()]/selector[3]/level none", > "set entry[last()]/selector[4]/facility cron", > "set entry[last()]/selector[4]/level none", > "set entry[last()]/action/hostname syslog_host", > ], > onlyif => "match entry[hostname = ''syslog_host''] size == 0", > } > > which is a lot of entries just for one line of config file, also augeas > has some problem on Solaris 10 to parse /etc/syslog.conf , > > it there a better way ? I know could use file server or template, but I''m > just trying to add an entry to the existing syslog.conf file, rather than > store them in puppet master. > there''s a puppet module at https://github.com/mstrauss/puppet-editfile , > which I haven''t tried yet. > > Is there a plan to add "editfile" feature to puppet , this is becoming > rather frustrating . > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/YqXFiwuWtxQJ. > 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.-- Erik Dalén -- 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.