2009-08-28 11:15:35 +02:00
|
|
|
/*
|
|
|
|
== Definition: postfix::hash
|
|
|
|
|
|
|
|
Creates postfix hashed "map" files. It will create "${name}", and then build
|
|
|
|
"${name}.db" using the "postmap" command. The map file can then be referred to
|
|
|
|
using postfix::config.
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
- *name*: the name of the map file.
|
2010-08-15 18:58:29 +02:00
|
|
|
- *ensure*: present/absent, defaults to present.
|
|
|
|
- *source*: file source.
|
2009-08-28 11:15:35 +02:00
|
|
|
|
|
|
|
Requires:
|
|
|
|
- Class["postfix"]
|
|
|
|
|
|
|
|
Example usage:
|
|
|
|
|
|
|
|
node "toto.example.com" {
|
|
|
|
|
2013-01-25 17:03:24 +01:00
|
|
|
class { 'postfix': }
|
2009-08-28 11:15:35 +02:00
|
|
|
|
|
|
|
postfix::hash { "/etc/postfix/virtual":
|
|
|
|
ensure => present,
|
|
|
|
}
|
|
|
|
postfix::config { "virtual_alias_maps":
|
|
|
|
value => "hash:/etc/postfix/virtual"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
2010-08-15 18:58:29 +02:00
|
|
|
define postfix::hash ($ensure="present", $source = false) {
|
2012-02-16 16:58:09 +01:00
|
|
|
include ::postfix
|
2010-08-15 18:58:29 +02:00
|
|
|
case $source {
|
|
|
|
false: {
|
|
|
|
file {"${name}":
|
|
|
|
ensure => $ensure,
|
|
|
|
mode => 600,
|
2010-08-18 03:31:07 +02:00
|
|
|
owner => root,
|
|
|
|
group => root,
|
2012-02-16 16:58:09 +01:00
|
|
|
seltype => $postfix::postfix_seltype,
|
2010-08-15 18:58:29 +02:00
|
|
|
require => Package["postfix"],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
file {"${name}":
|
|
|
|
ensure => $ensure,
|
|
|
|
mode => 600,
|
2010-08-18 03:31:07 +02:00
|
|
|
owner => root,
|
|
|
|
group => root,
|
2010-08-15 18:58:29 +02:00
|
|
|
source => $source,
|
2012-02-16 16:58:09 +01:00
|
|
|
seltype => $postfix::postfix_seltype,
|
2010-08-15 18:58:29 +02:00
|
|
|
require => Package["postfix"],
|
|
|
|
}
|
|
|
|
}
|
2008-12-03 17:53:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
file {"${name}.db":
|
|
|
|
ensure => $ensure,
|
|
|
|
mode => 600,
|
|
|
|
require => [File["${name}"], Exec["generate ${name}.db"]],
|
2012-02-16 16:58:09 +01:00
|
|
|
seltype => $postfix::postfix_seltype,
|
2008-12-03 17:53:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
exec {"generate ${name}.db":
|
|
|
|
command => "postmap ${name}",
|
|
|
|
#creates => "${name}.db", # this prevents postmap from being run !
|
|
|
|
subscribe => File["${name}"],
|
2009-07-21 21:44:03 +02:00
|
|
|
refreshonly => true,
|
|
|
|
require => Package["postfix"],
|
2008-12-03 17:53:28 +01:00
|
|
|
}
|
|
|
|
}
|