Puppet Class: sendmail
- Inherits:
- sendmail::params
- Defined in:
- manifests/init.pp
Overview
Class: sendmail
Module for sendmail configuration.
Parameters
- sendmail_mc_template
-
Path to the sendmail.mc template
- smart_host
-
The smtp outgoing server
- smtp_port
-
The smtp port
- exposed_user
-
The username to be displayed instead of the masquerade name
- masquerade_as
-
This causes mail being sent to be labeled as coming from the indicated host.domain
- masquerade_envelope
-
If masquerading is enabled or the genericstable is in use, set this parameter to true to also masquerade envelopes, normally only the header addresses are masqueraded
- masquerade_entire_domain
-
Set this to true if you need all hosts within the masquerading domains to be rewritten to the masquerade name
- masquerade_domain
-
The effect of this is that although mail to user@otherhost.domain will not be delivered locally, any mail including any user@otherhost.domain will, when relayed, be rewritten to have the masquerade_as address; this can be a space-separated list of names
- rootmail
-
Mail address for the root user, default is undef
- aliases
-
Hash of aliases. Example: { ‘user’ => ‘email’ }
- generics_domains
-
List of domains to serve. Example: [ ‘domain1.com’, ‘domain2.com’ }
- generics_table
-
Hash of user email addresses for multiple domains. Example: { ‘user’, ‘email’ }
- auth_user
-
SMTP user, not used for authentication
- auth_email
-
SMTP email (username)
- auth_password
-
SMTP password
Examples
class { sendmail:
sendmail_mc_template => 'mymodule/mytemplate.erb'
}
Authors
Alessandro De Salvo <Alessandro.DeSalvo@roma1.infn.it>
Copyright
Copyright 2014 Alessandro De Salvo.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'manifests/init.pp', line 72
class sendmail (
$sendmail_mc_template = $sendmail::params::sendmail_mc_tmpl,
$smart_host = undef,
$smtp_port = undef,
$exposed_user = 'root',
$masquerade_as = false,
$masquerade_envelope = false,
$masquerade_entire_domain = false,
$masquerade_domain = false,
$rootmail = undef,
$aliases = undef,
$generics_domains = undef,
$generics_table = undef,
$auth_user = 'root',
$auth_email = undef,
$auth_password = undef,
) inherits sendmail::params {
package { $sendmail::params::sendmail_pkgs: ensure => latest }
file { $sendmail::params::sendmail_mc_path:
owner => 'root',
group => 'root',
mode => '0644',
content => template($sendmail::params::sendmail_mc_tmpl),
require => Package[$sendmail::params::sendmail_pkgs],
notify => Exec["make_sendmail_config"],
}
if ($aliases) {
file { $sendmail::params::aliases_path:
owner => 'root',
group => 'root',
mode => '0644',
content => template($sendmail::params::aliases_tmpl),
require => Package[$sendmail::params::sendmail_pkgs],
notify => Service[$sendmail::service_name],
}
} else {
file { $sendmail::params::aliases_path: ensure => absent, notify => Service[$sendmail::service_name] }
}
if ($generics_domains) {
file { $sendmail::params::generics_domains_path:
owner => 'root',
group => 'root',
mode => '0644',
content => template($sendmail::params::generics_domains_tmpl),
require => Package[$sendmail::params::sendmail_pkgs],
notify => Service[$sendmail::service_name],
}
} else {
file { $sendmail::params::generics_domains_path: ensure => absent, notify => Service[$sendmail::service_name] }
}
if ($generics_table) {
file { $sendmail::params::generics_table_path:
owner => 'root',
group => 'root',
mode => '0644',
content => template($sendmail::params::generics_table_tmpl),
require => Package[$sendmail::params::sendmail_pkgs],
notify => Service[$sendmail::service_name],
}
} else {
file { $sendmail::params::generics_table_path: ensure => absent, notify => Service[$sendmail::service_name] }
}
if ($auth_email and $auth_password) {
file { $sendmail::params::authinfo_path:
owner => 'root',
group => 'root',
mode => '0644',
content => template($sendmail::params::authinfo_tmpl),
require => Package[$sendmail::params::sendmail_pkgs],
notify => Exec['make_authinfo_map'],
}
exec { 'make_authinfo_map' :
command => "makemap hash $sendmail::params::authinfo_path < $sendmail::params::authinfo_path",
path => [ "/bin", "/usr/sbin" ],
cwd => '/etc/mail',
refreshonly => true,
notify => Exec['make_sendmail_config'],
}
} else {
file { $sendmail::params::authinfo_path: ensure => absent, notify => Exec['make_sendmail_config'] }
}
exec { "make_sendmail_config" :
command => 'make -C /etc/mail',
path => [ "/bin", "/usr/bin" ],
cwd => '/etc/mail',
refreshonly => true,
notify => Service[$sendmail::service_name],
}
if ($rootmail) {
mailalias { "root mail alias":
ensure => present,
name => 'root',
recipient => $rootmail,
notify => Service[$sendmail::service_name],
}
}
service { "sendmail" :
ensure => running,
enable => true,
require => Package[$sendmail::params::sendmail_pkgs],
}
}
|