Hi All, What is the recommended way of managing something like the postfix configuration file? I would prefer _not_ to overwrite the config file with one stored centrally or using the templating system. Ideally I''d like to use the ''postconf'' and ''postconf -e'' programs to get and set options. Has this been done? My googling didn''t turn up anything. How would I go about doing this? Just the terminology of the configuration options would be enough to get me started. Regards Darryl --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
2008/9/8 Darryl Ross <spam@afoyi.com>:> > Hi All, > > What is the recommended way of managing something like the postfix > configuration file? I would prefer _not_ to overwrite the config file with one > stored centrally or using the templating system. > > Ideally I''d like to use the ''postconf'' and ''postconf -e'' programs to get and > set options.The ugly way is to write some exec+onlyif/unless defines that accept the parameters you need. This is how I deal with Glassfishv2, since the included asadmin tool does all of the validation required to write the correct XML out. The less ugly way is probably an augeas lens. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Francois Deppierraz
2008-Sep-08 08:05 UTC
[Puppet Users] Re: Managing Postfix Configuration
Darryl Ross wrote:> What is the recommended way of managing something like the postfix > configuration file? I would prefer _not_ to overwrite the config file with one > stored centrally or using the templating system. > > Ideally I''d like to use the ''postconf'' and ''postconf -e'' programs to get and > set options.Yes, that''s what we are using. define postfix::config ($ensure = present, $value, $nonstandard = false) { case $ensure { present: { exec {"postconf -e ${name}=''${value}''": unless => $nonstandard ? { false => "test x$(postconf -h ${name}) == ''x${value}''", true => "test x$(egrep ''^${name} '' /etc/postfix/main.cf | cut -d= -f2 | cut -d'' '' -f2) == ''x${value}''", }, notify => Service["postfix"], require => File["/etc/postfix/main.cf"], } } absent: { fail "postfix::config ensure => absent: Not implemented" } } } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi> The ugly way is to write some exec+onlyif/unless defines that accept > the parameters you need. This is how I deal with Glassfishv2, since > the included asadmin tool does all of the validation required to write > the correct XML out.well then you maybe could write your own provider> The less ugly way is probably an augeas lens.might be the preferred choice. greets pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks for this, the snippet below worked great, with a couple of minor changes, on my CentOS 5 system: - full path to /usr/bin/test - single equal in ''false'' test Thanks Francois! Regards Darryl Francois Deppierraz wrote:> Darryl Ross wrote: > >> What is the recommended way of managing something like the postfix >> configuration file? I would prefer _not_ to overwrite the config file with one >> stored centrally or using the templating system. >> >> Ideally I''d like to use the ''postconf'' and ''postconf -e'' programs to get and >> set options. > > Yes, that''s what we are using. > > define postfix::config ($ensure = present, $value, $nonstandard = false) { > case $ensure { > present: { > exec {"postconf -e ${name}=''${value}''": > unless => $nonstandard ? { > false => "test x$(postconf -h ${name}) == ''x${value}''", > true => "test x$(egrep ''^${name} '' /etc/postfix/main.cf | cut > -d= -f2 | cut -d'' '' -f2) == ''x${value}''", > }, > notify => Service["postfix"], > require => File["/etc/postfix/main.cf"], > } > } > > absent: { > fail "postfix::config ensure => absent: Not implemented" > } > } > } > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---