Defined Type: postfix::config
- Defined in:
- manifests/config.pp
Summary
Set values in Postfix config fileOverview
Add/alter/remove options in Postfix main configuration file (main.cf). This uses Augeas to do the editing of the configuration file, as such any configuration value can be used.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'manifests/config.pp', line 42
define postfix::config (
Optional[String] $value = undef,
Enum['present', 'absent', 'blank'] $ensure = 'present',
) {
include postfix
if ($ensure == 'present') {
assert_type(Pattern[/^.+$/], $value) |$e, $a| {
fail "value for parameter: ${title} can not be empty if ensure = present"
}
}
if (!defined(Class['postfix'])) {
fail 'You must define class postfix before using postfix::config!'
}
case $ensure {
'present': {
$changes = "set ${name} '${value}'"
}
'absent': {
$changes = "rm ${name}"
}
'blank': {
$changes = "clear ${name}"
}
default: {
fail "Unknown value for ensure '${ensure}'"
}
}
# TODO: make this a type with an Augeas and a postconf providers.
augeas { "manage postfix '${title}'":
incl => "${postfix::confdir}/main.cf",
lens => 'Postfix_Main.lns',
changes => $changes,
require => File["${postfix::confdir}/main.cf"],
}
Postfix::Config[$title] ~> Class['postfix::service']
}
|