Puppet Class: postfix::config
- Defined in:
- manifests/config.pp
Summary
Manages all postfix configuration and check files.Overview
This subclass manages all postfix configuration files from master.cf and
main.cf to all custom, user-created setting and check files. All of these
files are kept on the node unless postfix::package_ensure:
purged
.
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 |
# File 'manifests/config.pp', line 110
class postfix::config {
if 'purged' == $postfix::package_ensure {
# Note: never destroy the $virtual_delivery_dir to avoid destroying mail.
file { $postfix::config_file_path:
ensure => absent,
force => true,
}
} else {
$knockout_prefix = $postfix::config_hash_key_knockout_prefix
# Ensure the configuration directory exists
$purge_recurse_limit = $postfix::purge_config_file_path ? {
true => 1,
default => undef,
}
file { $postfix::config_file_path:
ensure => directory,
purge => $postfix::purge_config_file_path,
recurse => $postfix::purge_config_file_path,
recurselimit => $purge_recurse_limit,
* => $postfix::config_file_path_attributes,
}
# Manage master.cf and main.cf
file {
default:
ensure => file,
* => $postfix::config_file_attributes,;
"${postfix::config_file_path}/master.cf":
content => template("${module_name}/master-processes.erb"),;
"${postfix::config_file_path}/main.cf":
content => template("${module_name}/global-parameters.erb"),;
}
# Manage all auxilliary configuration files
pick($postfix::config_files, {}).each | String $file, Hash $config, | {
file { "${postfix::config_file_path}/${file}":
ensure => file,
content => template("${module_name}/config-file.erb"),
* => $postfix::config_file_attributes,
}
}
pick($postfix::check_files, {}).each |
String $file,
Array[String] $rules,
| {
file { "${postfix::config_file_path}/${file}":
ensure => file,
content => template("${module_name}/check-file.erb"),
* => $postfix::config_file_attributes,
}
}
# Manage the optional $virtual_delivery_dir, if used.
if undef != $postfix::virtual_delivery_dir {
# No default attributes for this directory will be assumed because it is
# critical that Postfix be able to write to this directory tree.
if undef == $postfix::virtual_delivery_dir_attributes {
fail('When setting postfix::virtual_delivery_dir, you must also provide attributes as a Hash to postfix::virtual_delivery_dir_attributes.')
}
file { $postfix::virtual_delivery_dir:
ensure => directory,
* => $postfix::virtual_delivery_dir_attributes,
}
}
}
}
|