summaryrefslogtreecommitdiff
path: root/manifests/definitions
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2012-02-16 16:51:56 +0100
committerSilvio Rhatto <rhatto@riseup.net>2012-04-07 13:56:47 -0300
commit59010a1c304801db6423f67d656399478fc603f0 (patch)
tree2ff29f6c26451f2dd62f53a3a5abb5b09bef7ab4 /manifests/definitions
parent462db65ec48b6398c9a04a88cc4c197eb73f34fa (diff)
put classes and defines in the proper place
To take advantage of puppet's autoloading feature, which will be mandatory sooner or later. We move all the files in their appropriate place.
Diffstat (limited to 'manifests/definitions')
-rw-r--r--manifests/definitions/config.pp49
-rw-r--r--manifests/definitions/hash.pp87
-rw-r--r--manifests/definitions/header_checks_snippet.pp67
-rw-r--r--manifests/definitions/mailalias.pp32
-rw-r--r--manifests/definitions/tlspolicy_snippet.pp47
-rw-r--r--manifests/definitions/transport.pp44
-rw-r--r--manifests/definitions/virtual.pp44
7 files changed, 0 insertions, 370 deletions
diff --git a/manifests/definitions/config.pp b/manifests/definitions/config.pp
deleted file mode 100644
index 8e203a6..0000000
--- a/manifests/definitions/config.pp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-== Definition: postfix::config
-
-Uses the "postconf" command to add/alter/remove options in postfix main
-configuation file (/etc/postfix/main.cf).
-
-Parameters:
-- *name*: name of the parameter.
-- *ensure*: present/absent. defaults to present.
-- *value*: value of the parameter.
-- *nonstandard*: inform postfix::config that this parameter is not recognized
- by the "postconf" command. defaults to false.
-
-Requires:
-- Class["postfix"]
-
-Example usage:
-
- node "toto.example.com" {
-
- include postfix
-
- postfix::config {
- "smtp_use_tls" => "yes";
- "smtp_sasl_auth_enable" => "yes";
- "smtp_sasl_password_maps" => "hash:/etc/postfix/my_sasl_passwords";
- "relayhost" => "[mail.example.com]:587";
- }
- }
-
-*/
-define postfix::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::config ensure => absent: Not implemented"
- }
- }
-}
diff --git a/manifests/definitions/hash.pp b/manifests/definitions/hash.pp
deleted file mode 100644
index c8bb7c7..0000000
--- a/manifests/definitions/hash.pp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-== 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.
-- *ensure*: present/absent, defaults to present.
-- *source*: file source.
-
-Requires:
-- Class["postfix"]
-
-Example usage:
-
- node "toto.example.com" {
-
- include postfix
-
- postfix::hash { "/etc/postfix/virtual":
- ensure => present,
- }
- postfix::config { "virtual_alias_maps":
- value => "hash:/etc/postfix/virtual"
- }
- }
-
-*/
-define postfix::hash ($ensure="present", $source = false) {
-
- # selinux labels differ from one distribution to another
- case $operatingsystem {
-
- RedHat, CentOS: {
- case $lsbmajdistrelease {
- "4": { $postfix_seltype = "etc_t" }
- "5": { $postfix_seltype = "postfix_etc_t" }
- default: { $postfix_seltype = undef }
- }
- }
-
- default: {
- $postfix_seltype = undef
- }
- }
-
- case $source {
- false: {
- file {"${name}":
- ensure => $ensure,
- mode => 600,
- owner => root,
- group => root,
- seltype => $postfix_seltype,
- require => Package["postfix"],
- }
- }
- default: {
- file {"${name}":
- ensure => $ensure,
- mode => 600,
- owner => root,
- group => root,
- source => $source,
- seltype => $postfix_seltype,
- require => Package["postfix"],
- }
- }
- }
-
- file {"${name}.db":
- ensure => $ensure,
- mode => 600,
- require => [File["${name}"], Exec["generate ${name}.db"]],
- seltype => $postfix_seltype,
- }
-
- exec {"generate ${name}.db":
- command => "postmap ${name}",
- #creates => "${name}.db", # this prevents postmap from being run !
- subscribe => File["${name}"],
- refreshonly => true,
- require => Package["postfix"],
- }
-}
diff --git a/manifests/definitions/header_checks_snippet.pp b/manifests/definitions/header_checks_snippet.pp
deleted file mode 100644
index 454d219..0000000
--- a/manifests/definitions/header_checks_snippet.pp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-== Definition: postfix::header_checks_snippet
-
-Adds a header_checks snippets to /etc/postfix/header_checks.
-See the postfix::header_checks class for details.
-
-Parameters:
-- *source* or *content*: source or content of the header_checks snippet
-- *ensure*: present (default) or absent
-
-Requires:
-- Class["postfix"]
-
-Example usage:
-
- node "toto.example.com" {
- include postfix
- postfix::header_checks {
- 'wrong_date': content => 'FIXME';
- 'bla': source => 'puppet:///files/etc/postfix/header_checks.d/bla';
- }
- }
-
-*/
-
-define postfix::header_checks_snippet (
- $ensure = "present",
- $source = '',
- $content = undef
-) {
-
- if $source == '' and $content == undef {
- fail("One of \$source or \$content must be specified for postfix::header_checks_snippet ${name}")
- }
-
- if $source != '' and $content != undef {
- fail("Only one of \$source or \$content must specified for postfix::header_checks_snippet ${name}")
- }
-
- if ($value == false) and ($ensure == "present") {
- fail("The value parameter must be set when using the postfix::header_checks_snippet define with ensure=present.")
- }
-
- include postfix::header_checks
-
- $snippetfile = "${postfix::header_checks::postfix_header_checks_snippets_dir}/${name}"
-
- file { "$snippetfile":
- ensure => "$ensure",
- mode => 600,
- owner => root,
- group => 0,
- notify => Exec["concat_${postfix::header_checks::postfix_merged_header_checks}"],
- }
-
- if $source {
- File["$snippetfile"] {
- source => $source,
- }
- }
- else {
- File["$snippetfile"] {
- content => $content,
- }
- }
-
-}
diff --git a/manifests/definitions/mailalias.pp b/manifests/definitions/mailalias.pp
deleted file mode 100644
index cd1af50..0000000
--- a/manifests/definitions/mailalias.pp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-== Definition: postfix::mailalias
-
-Wrapper around Puppet mailalias resource, provides newaliases executable.
-
-Parameters:
-- *name*: the name of the alias.
-- *ensure*: present/absent, defaults to present.
-- *recipient*: recipient of the alias.
-
-Requires:
-- Class["postfix"]
-
-Example usage:
-
- node "toto.example.com" {
-
- include postfix
-
- postfix::mailalias { "postmaster":
- ensure => present,
- recipient => 'foo'
- }
-
-*/
-define postfix::mailalias ($ensure = 'present', $recipient) {
- mailalias { "${name}":
- ensure => $ensure,
- recipient => $recipient,
- notify => Exec['newaliases']
- }
-}
diff --git a/manifests/definitions/tlspolicy_snippet.pp b/manifests/definitions/tlspolicy_snippet.pp
deleted file mode 100644
index 2596dbc..0000000
--- a/manifests/definitions/tlspolicy_snippet.pp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-== Definition: postfix::tlspolicy_snippet
-
-Adds a TLS policy snippets to /etc/postfix/tls_policy.d/.
-See the postfix::tlspolicy class for details.
-
-Parameters:
-- *name*: name of destination domain Postfix will lookup. See TLS_README.
-- *value*: right-hand part of the tls_policy map
-- *ensure*: present/absent, defaults to present.
-
-Requires:
-- Class["postfix"]
-- Class["postfix::tlspolicy"]
-
-Example usage:
-
- node "toto.example.com" {
- $postfix_manage_tls_policy = yes
- include postfix
- postfix::tlspolicy_snippet {
- 'example.com': value => 'encrypt';
- '.example.com': value => 'encrypt';
- 'nothing.com': value => 'fingerprint match=2A:FF:F0:EC:52:04:99:45:73:1B:C2:22:7F:FD:31:6B:8F:07:43:29';
- }
- }
-
-*/
-
-define postfix::tlspolicy_snippet ($ensure="present", $value = false) {
-
- include postfix::tlspolicy
-
- if ($value == false) and ($ensure == "present") {
- fail("The value parameter must be set when using the postfix::tlspolicy_snippet define with ensure=present.")
- }
-
- file { "${postfix::tlspolicy::postfix_tlspolicy_snippets_dir}/${name}":
- ensure => "$ensure",
- content => "${name} ${value}\n",
- mode => 600,
- owner => root,
- group => 0,
- notify => Exec["concat_${postfix::tlspolicy::postfix_merged_tlspolicy}"],
- }
-
-}
diff --git a/manifests/definitions/transport.pp b/manifests/definitions/transport.pp
deleted file mode 100644
index 5ca5554..0000000
--- a/manifests/definitions/transport.pp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-== Definition: postfix::transport
-
-Manages content of the /etc/postfix/transport map.
-
-Parameters:
-- *name*: name of address postfix will lookup. See transport(5).
-- *destination*: where the emails will be delivered to. See transport(5).
-- *ensure*: present/absent, defaults to present.
-
-Requires:
-- Class["postfix"]
-- Postfix::Hash["/etc/postfix/transport"]
-- Postfix::Config["transport_maps"]
-- common::line (from module common)
-
-Example usage:
-
- node "toto.example.com" {
-
- include postfix
-
- postfix::hash { "/etc/postfix/transport":
- ensure => present,
- }
- postfix::config { "transport_maps":
- value => "hash:/etc/postfix/transport"
- }
- postfix::transport { "mailman.example.com":
- ensure => present,
- destination => "mailman",
- }
- }
-
-*/
-define postfix::transport ($ensure="present", $destination) {
- line {"${name} ${destination}":
- ensure => $ensure,
- file => "/etc/postfix/transport",
- line => "${name} ${destination}",
- notify => Exec["generate /etc/postfix/transport.db"],
- require => Package["postfix"],
- }
-}
diff --git a/manifests/definitions/virtual.pp b/manifests/definitions/virtual.pp
deleted file mode 100644
index 8fcd53a..0000000
--- a/manifests/definitions/virtual.pp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-== Definition: postfix::virtual
-
-Manages content of the /etc/postfix/virtual map.
-
-Parameters:
-- *name*: name of address postfix will lookup. See virtual(8).
-- *destination*: where the emails will be delivered to. See virtual(8).
-- *ensure*: present/absent, defaults to present.
-
-Requires:
-- Class["postfix"]
-- Postfix::Hash["/etc/postfix/virtual"]
-- Postfix::Config["virtual_alias_maps"]
-- common::line (from module common)
-
-Example usage:
-
- node "toto.example.com" {
-
- include postfix
-
- postfix::hash { "/etc/postfix/virtual":
- ensure => present,
- }
- postfix::config { "virtual_alias_maps":
- value => "hash:/etc/postfix/virtual"
- }
- postfix::virtual { "user@example.com":
- ensure => present,
- destination => "root",
- }
- }
-
-*/
-define postfix::virtual ($ensure="present", $destination) {
- line {"${name} ${destination}":
- ensure => $ensure,
- file => "/etc/postfix/virtual",
- line => "${name} ${destination}",
- notify => Exec["generate /etc/postfix/virtual.db"],
- require => Package["postfix"],
- }
-}