Defined Type: postfix::conffile
- Defined in:
- manifests/conffile.pp
Summary
Manage a Postfix configuration fileOverview
Manages Postfix configuration files. With it, you could create configuration files (other than, main.cf, master.cf, etc.) restarting Postfix when necessary.
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'manifests/conffile.pp', line 51
define postfix::conffile (
Enum['present', 'absent', 'directory'] $ensure = 'present',
Variant[Array[String], String, Undef] $source = undef,
Optional[String] $content = undef,
Optional[Stdlib::Absolutepath] $path = undef,
Stdlib::Filemode $mode = '0640',
Hash $options = {},
Boolean $show_diff = true,
) {
include postfix
$_path = pick($path, "${postfix::confdir}/${name}")
if (!defined(Class['postfix'])) {
fail 'You must define class postfix before using postfix::config!'
}
if $source and $content {
fail 'You must provide either \'source\' or \'content\', not both'
}
if !$source and !$content and $ensure == 'present' and empty($options) {
fail 'You must provide \'options\' hash parameter if you don\'t provide \'source\' neither \'content\''
}
$manage_file_source = $source ? {
'' => undef,
default => $source,
}
$manage_content = $content ? {
undef => $source ? {
undef => template('postfix/conffile.erb'),
default => undef,
},
default => $content,
}
file { "postfix conffile ${name}":
ensure => $ensure,
path => $_path,
mode => $mode,
owner => 'root',
group => 'postfix',
seltype => $postfix::params::seltype,
require => Package['postfix'],
source => $source,
content => $manage_content,
show_diff => $show_diff,
notify => Service['postfix'],
}
}
|