diff options
Diffstat (limited to 'manifests/definitions')
-rw-r--r-- | manifests/definitions/config.pp | 18 | ||||
-rw-r--r-- | manifests/definitions/hash.pp | 19 | ||||
-rw-r--r-- | manifests/definitions/transport.pp | 8 | ||||
-rw-r--r-- | manifests/definitions/virtual.pp | 8 |
4 files changed, 53 insertions, 0 deletions
diff --git a/manifests/definitions/config.pp b/manifests/definitions/config.pp new file mode 100644 index 0000000..ec6c782 --- /dev/null +++ b/manifests/definitions/config.pp @@ -0,0 +1,18 @@ +define postfix-ng::config ($ensure = present, $value, $nonstandard = false) { + case $ensure { + present: { + exec {"postconf -e ${name}='${value}'": + unless => $nonstandard ? { + false => "test \"x$(postconf -h ${name})\" == 'x${value}'", + true => "test \"x$(egrep '^${name} ' /etc/postfix/main.cf | cut -d= -f2 | cut -d' ' -f2)\" == 'x${value}'", + }, + notify => Service["postfix"], + require => File["/etc/postfix/main.cf"], + } + } + + absent: { + fail "postfix-ng::config ensure => absent: Not implemented" + } + } +} diff --git a/manifests/definitions/hash.pp b/manifests/definitions/hash.pp new file mode 100644 index 0000000..f21e270 --- /dev/null +++ b/manifests/definitions/hash.pp @@ -0,0 +1,19 @@ +define postfix-ng::hash ($ensure) { + file {"${name}": + ensure => $ensure, + mode => 600, + } + + file {"${name}.db": + ensure => $ensure, + mode => 600, + require => [File["${name}"], Exec["generate ${name}.db"]], + } + + exec {"generate ${name}.db": + command => "postmap ${name}", + #creates => "${name}.db", # this prevents postmap from being run ! + subscribe => File["${name}"], + refreshonly => true + } +} diff --git a/manifests/definitions/transport.pp b/manifests/definitions/transport.pp new file mode 100644 index 0000000..ea23bf6 --- /dev/null +++ b/manifests/definitions/transport.pp @@ -0,0 +1,8 @@ +define postfix-ng::transport ($ensure, $destination) { + line {"${name} ${destination}": + ensure => present, + file => "/etc/postfix/transport", + line => "${name} ${destination}", + notify => Exec["generate /etc/postfix/transport.db"], + } +} diff --git a/manifests/definitions/virtual.pp b/manifests/definitions/virtual.pp new file mode 100644 index 0000000..950107c --- /dev/null +++ b/manifests/definitions/virtual.pp @@ -0,0 +1,8 @@ +define postfix-ng::virtual ($ensure, $destination) { + line {"${name} ${destination}": + ensure => present, + file => "/etc/postfix/virtual", + line => "${name} ${destination}", + notify => Exec["generate /etc/postfix/virtual.db"], + } +} |