diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-04-07 15:40:42 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-04-07 15:40:42 -0300 |
commit | 531d802bad6894a9b81393053b3e6ac7fdde2cba (patch) | |
tree | d6e85e01ca5569ef162e8678e846c5c4b41f5a4d /manifests/transport_regexp_snippet.pp | |
parent | 59010a1c304801db6423f67d656399478fc603f0 (diff) | |
download | puppet-postfix-531d802bad6894a9b81393053b3e6ac7fdde2cba.tar.gz puppet-postfix-531d802bad6894a9b81393053b3e6ac7fdde2cba.tar.bz2 |
Adding transport_regexp and virtual_regexp management
Diffstat (limited to 'manifests/transport_regexp_snippet.pp')
-rw-r--r-- | manifests/transport_regexp_snippet.pp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/manifests/transport_regexp_snippet.pp b/manifests/transport_regexp_snippet.pp new file mode 100644 index 0000000..eb43c37 --- /dev/null +++ b/manifests/transport_regexp_snippet.pp @@ -0,0 +1,67 @@ +/* +== Definition: postfix::transport_regexp_snippet + +Adds a transport_regexp snippets to /etc/postfix/transport_regexp. +See the postfix::transport_regexp class for details. + +Parameters: +- *source* or *content*: source or content of the transport_regexp snippet +- *ensure*: present (default) or absent + +Requires: +- Class["postfix"] + +Example usage: + + node "toto.example.com" { + include postfix + postfix::transport_regexp { + 'wrong_date': content => 'FIXME'; + 'bla': source => 'puppet:///files/etc/postfix/transport_regexp.d/bla'; + } + } + +*/ + +define postfix::transport_regexp_snippet ( + $ensure = "present", + $source = '', + $content = undef +) { + + if $source == '' and $content == undef { + fail("One of \$source or \$content must be specified for postfix::transport_regexp_snippet ${name}") + } + + if $source != '' and $content != undef { + fail("Only one of \$source or \$content must specified for postfix::transport_regexp_snippet ${name}") + } + + if ($value == false) and ($ensure == "present") { + fail("The value parameter must be set when using the postfix::transport_regexp_snippet define with ensure=present.") + } + + include postfix::transport_regexp + + $snippetfile = "${postfix::transport_regexp::postfix_transport_regexp_snippets_dir}/${name}" + + file { "$snippetfile": + ensure => "$ensure", + mode => 600, + owner => root, + group => 0, + notify => Exec["concat_${postfix::transport_regexp::postfix_merged_transport_regexp}"], + } + + if $source { + File["$snippetfile"] { + source => $source, + } + } + else { + File["$snippetfile"] { + content => $content, + } + } + +} |