Re: [Puppet Users] Puppet - Postfix - How-To edit generic.db

2012-11-09 Thread Tim Mooney

In regard to: [Puppet Users] Puppet - Postfix - How-To edit generic.db,...:


New-ish to Puppet.  I'm just getting beyond the basics, now.

Got a postfix module defined.  But there is a wrinkle: the server needs to
send mail from root as r...@domain.com not r...@hostname.domain.com


So the big question is whether this config needs to be applied to *all*
the systems where you might run postfix, or whether it's specific to
one particular system or set of systems.


Because our service desk accepts tickets from servers BUT the counts as
'spam' anything NOT from domain.com.

This is easy with postfix:

edit /etc/postfix/generic - add "r...@hostname.domain.com
hostn...@domain.com"


You need to modify a file, so you'll want to have a file resource
defined somewhere.  Are there other settings in that file you typically
customize?  If so, you may want the source for the file to be a
template().  If not, there are other ways you might handle it.

So, the file resource is going to look something like

file { '/etc/postfix/generic':
ensure => file,
owner  => 'some_user',
group  => 'some_group',
mode   => '0somethingsomethingsomething',
source => yet_to_be_determined,
notify => Exec['postmap-generic'],
}

The real question is what goes in the "yet_to_be_determined" area for
the source.  It could be a template

source => template('postfix/generic.erb'),

or perhaps it's a list of files (first one that matches is used):

source => [
"puppet:///modules/postfix/generic.${::fqdn}",
'puppet:///modules/postfix/generic',
],

Determining how you pick the source for the file is going to be the
most difficult part of this, and it depends on how much customization
you need to do.


$ postmap /etc/postfix/generic


For that, you need an exec resource to execute your command after the file
is modified:

exec { 'postmap-generic':
cwd => '/etc/postfix',
path=> '/bin:/usr/bin:/sbin:/usr/sbin',
command => 'postmap generic',
refreshonly => true,
notify  => Service['postfix'],
}


restart service postfix


service { 'postfix':
ensure => running,
enable => true,
}

Tim
--
Tim Mooney tim.moo...@ndsu.edu
Enterprise Computing & Infrastructure  701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Puppet - Postfix - How-To edit generic.db

2012-11-09 Thread Brian Dunbar
New-ish to Puppet.  I'm just getting beyond the basics, now.

Got a postfix module defined.  But there is a wrinkle: the server needs to 
send mail from root as r...@domain.com not r...@hostname.domain.com

Because our service desk accepts tickets from servers BUT the counts as 
'spam' anything NOT from domain.com.

This is easy with postfix:

edit /etc/postfix/generic - add "r...@hostname.domain.com 
hostn...@domain.com"
$ postmap /etc/postfix/generic
restart service postfix

How do I tell puppet do this?

-- 
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/-/pYu9vRELtQwJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.