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
ro...@domain.com not
ro...@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.
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.M...@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