aboutsummaryrefslogtreecommitdiff
path: root/manifests/classes
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/classes
parent462db65ec48b6398c9a04a88cc4c197eb73f34fa (diff)
downloadpuppet-postfix-59010a1c304801db6423f67d656399478fc603f0.tar.gz
puppet-postfix-59010a1c304801db6423f67d656399478fc603f0.tar.bz2
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/classes')
-rw-r--r--manifests/classes/postfix-amavis.pp5
-rw-r--r--manifests/classes/postfix-anonsasl.pp18
-rw-r--r--manifests/classes/postfix-header_checks.pp57
-rw-r--r--manifests/classes/postfix-mailman.pp36
-rw-r--r--manifests/classes/postfix-mta.pp61
-rw-r--r--manifests/classes/postfix-satellite.pp38
-rw-r--r--manifests/classes/postfix-tlspolicy.pp71
-rw-r--r--manifests/classes/postfix.pp178
8 files changed, 0 insertions, 464 deletions
diff --git a/manifests/classes/postfix-amavis.pp b/manifests/classes/postfix-amavis.pp
deleted file mode 100644
index b663923..0000000
--- a/manifests/classes/postfix-amavis.pp
+++ /dev/null
@@ -1,5 +0,0 @@
-class postfix::amavis {
- postfix::config {
- "content_filter": value => "amavis:[127.0.0.1]:10024";
- }
-}
diff --git a/manifests/classes/postfix-anonsasl.pp b/manifests/classes/postfix-anonsasl.pp
deleted file mode 100644
index ca97f19..0000000
--- a/manifests/classes/postfix-anonsasl.pp
+++ /dev/null
@@ -1,18 +0,0 @@
-class postfix::anonsasl {
-
- include postfix::header_checks
-
- postfix::config {
- 'smtpd_sasl_authenticated_header':
- value => 'yes';
- }
-
- postfix::header_checks_snippet {
- 'anonsasl':
- content => template("postfix/anonsasl_header_checks.erb"),
- require => [
- Postfix::Config['smtpd_sasl_authenticated_header'],
- ];
- }
-
-}
diff --git a/manifests/classes/postfix-header_checks.pp b/manifests/classes/postfix-header_checks.pp
deleted file mode 100644
index 071f6b0..0000000
--- a/manifests/classes/postfix-header_checks.pp
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# == Class: postfix::header_checks
-#
-# Manages Postfix header_checks by merging snippets shipped:
-# - in the module's files/header_checks.d/ or puppet:///files/etc/postfix/header_checks.d
-# (the latter takes precedence if present); site-postfix module is supported
-# as well, see the source argument of file {"$postfix_header_checks_snippets_dir"
-# bellow for details.
-# - via postfix::header_checks_snippet defines
-#
-# Example usage:
-#
-# node "toto.example.com" {
-# $postfix_manage_header_checks = yes
-# include postfix
-# }
-#
-class postfix::header_checks {
-
- include common::moduledir
- module_dir{'postfix/header_checks': }
-
- $postfix_header_checks_dir = "${common::moduledir::module_dir_path}/postfix/header_checks"
- $postfix_header_checks_snippets_dir = "${postfix_header_checks_dir}/header_checks.d"
- $postfix_merged_header_checks = "${postfix_header_checks_dir}/merged_header_checks"
-
- file {"$postfix_header_checks_snippets_dir":
- ensure => 'directory',
- owner => 'root',
- group => '0',
- mode => '700',
- source => [
- "puppet:///modules/site-postfix/${fqdn}/header_checks.d",
- "puppet:///modules/site-postfix/header_checks.d",
- "puppet:///files/etc/postfix/header_checks.d",
- "puppet:///modules/postfix/header_checks.d",
- ],
- recurse => true,
- purge => false,
- }
-
- concatenated_file { "$postfix_merged_header_checks":
- dir => "${postfix_header_checks_snippets_dir}",
- require => File["$postfix_header_checks_snippets_dir"],
- }
-
- config_file { '/etc/postfix/header_checks':
- source => "$postfix_merged_header_checks",
- subscribe => File["$postfix_merged_header_checks"],
- }
-
- postfix::config { "header_checks":
- value => 'regexp:/etc/postfix/header_checks',
- require => File['/etc/postfix/header_checks'],
- }
-
-}
diff --git a/manifests/classes/postfix-mailman.pp b/manifests/classes/postfix-mailman.pp
deleted file mode 100644
index cba0848..0000000
--- a/manifests/classes/postfix-mailman.pp
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# == Class: postfix::mailman
-#
-# Configures a basic smtp server, able to work for the mailman mailing-list
-# manager.
-#
-# Parameters:
-# - every global variable which works for class "postfix" will work here.
-#
-# Example usage:
-#
-# node "toto.example.com" {
-# include mailman
-# include postfix::mailman
-# }
-#
-class postfix::mailman {
- $postfix_smtp_listen = "0.0.0.0"
- include postfix
-
- postfix::config {
- "mydestination": value => "";
- "virtual_alias_maps": value => "hash:/etc/postfix/virtual";
- "transport_maps": value => "hash:/etc/postfix/transport";
- "mailman_destination_recipient_limit": value => "1", nonstandard => true;
- }
-
- postfix::hash { "/etc/postfix/virtual":
- ensure => present,
- }
-
- postfix::hash { "/etc/postfix/transport":
- ensure => present,
- }
-
-}
diff --git a/manifests/classes/postfix-mta.pp b/manifests/classes/postfix-mta.pp
deleted file mode 100644
index c36c0bc..0000000
--- a/manifests/classes/postfix-mta.pp
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# == Class: postfix::mta
-#
-# This class configures a minimal MTA, listening on
-# $postfix_smtp_listen (default to localhost) and delivering mail to
-# $postfix_mydestination (default to $fqdn).
-#
-# A valid relay host is required ($postfix_relayhost) for outbound email.
-#
-# transport & virtual maps get configured and can be populated with
-# postfix::transport and postfix::virtual
-#
-# Parameters:
-# - *$postfix_relayhost*
-# - *$postfix_mydestination*
-# - every global variable which works for class "postfix" will work here.
-#
-# Example usage:
-#
-# node "toto.example.com" {
-# $postfix_relayhost = "mail.example.com"
-# $postfix_smtp_listen = "0.0.0.0"
-# $postfix_mydestination = "\$myorigin, myapp.example.com"
-#
-# include postfix::mta
-#
-# postfix::transport { "myapp.example.com":
-# ensure => present,
-# destination => "local:",
-# }
-# }
-#
-class postfix::mta {
-
- #case $postfix_relayhost {
- # "": { fail("Required \$postfix_relayhost variable is not defined.") }
- #}
-
- case $postfix_mydestination {
- "": { $postfix_mydestination = "\$myorigin" }
- }
-
- include postfix
-
- postfix::config {
- "mydestination": value => $postfix_mydestination;
- "mynetworks": value => "127.0.0.0/8";
- "relayhost": value => $postfix_relayhost;
- "virtual_alias_maps": value => "hash:/etc/postfix/virtual";
- "transport_maps": value => "hash:/etc/postfix/transport";
- }
-
- postfix::hash { "/etc/postfix/virtual":
- ensure => present,
- }
-
- postfix::hash { "/etc/postfix/transport":
- ensure => present,
- }
-
-}
diff --git a/manifests/classes/postfix-satellite.pp b/manifests/classes/postfix-satellite.pp
deleted file mode 100644
index cb92a9f..0000000
--- a/manifests/classes/postfix-satellite.pp
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# == Class: postfix::satellite
-#
-# This class configures all local email (cron, mdadm, etc) to be forwarded
-# to $root_mail_recipient, using $postfix_relayhost as a relay.
-#
-# $valid_fqdn can be set to override $fqdn in the case where the FQDN is
-# not recognized as valid by the destination server.
-#
-# Parameters:
-# - *valid_fqdn*
-# - every global variable which works for class "postfix" will work here.
-#
-# Example usage:
-#
-# node "toto.local.lan" {
-# $postfix_relayhost = "mail.example.com"
-# $valid_fqdn = "toto.example.com"
-# $root_mail_recipient = "the.sysadmin@example.com"
-#
-# include postfix::satellite
-# }
-#
-class postfix::satellite {
-
- # If $valid_fqdn exists, use it to override $fqdn
- case $valid_fqdn {
- "": { $valid_fqdn = $fqdn }
- default: { $fqdn = "${valid_fqdn}" }
- }
-
- include postfix::mta
-
- postfix::virtual {"@${valid_fqdn}":
- ensure => present,
- destination => "root",
- }
-}
diff --git a/manifests/classes/postfix-tlspolicy.pp b/manifests/classes/postfix-tlspolicy.pp
deleted file mode 100644
index 633c380..0000000
--- a/manifests/classes/postfix-tlspolicy.pp
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# == Class: postfix::tlspolicy
-#
-# Manages Postfix TLS policy by merging policy snippets shipped:
-# - in the module's files/tls_policy.d/ or puppet:///files/etc/postfix/tls_policy.d
-# (the latter takes precedence if present); site-postfix module is supported
-# as well, see the source argument of file {"$postfix_tlspolicy_snippets_dir"
-# bellow for details.
-# - via postfix::tlspolicy_snippet defines
-#
-# Parameters:
-# - $postfix_tls_fingerprint_digest (defaults to sha1)
-#
-# Example usage:
-#
-# node "toto.example.com" {
-# $postfix_manage_tls_policy = yes
-# include postfix
-# }
-#
-class postfix::tlspolicy {
-
- # Default value for parameters
- case $postfix_tls_fingerprint_digest {
- "": { $postfix_tls_fingerprint_digest = 'sha1' }
- }
-
- include common::moduledir
- module_dir{'postfix/tls_policy': }
-
- $postfix_tlspolicy_dir = "${common::moduledir::module_dir_path}/postfix/tls_policy"
- $postfix_tlspolicy_snippets_dir = "${postfix_tlspolicy_dir}/tls_policy.d"
- $postfix_merged_tlspolicy = "${postfix_tlspolicy_dir}/merged_tls_policy"
-
- file {"$postfix_tlspolicy_snippets_dir":
- ensure => 'directory',
- owner => 'root',
- group => '0',
- mode => '700',
- source => [
- "puppet:///modules/site-postfix/${fqdn}/tls_policy.d",
- "puppet:///modules/site-postfix/tls_policy.d",
- "puppet:///modules/postfix/tls_policy.d",
- ],
- recurse => true,
- purge => false,
- }
-
- concatenated_file { "$postfix_merged_tlspolicy":
- dir => "${postfix_tlspolicy_snippets_dir}",
- require => File["$postfix_tlspolicy_snippets_dir"],
- }
-
- postfix::hash { '/etc/postfix/tls_policy':
- source => "$postfix_merged_tlspolicy",
- subscribe => File["$postfix_merged_tlspolicy"],
- }
-
- postfix::config {
- 'smtp_tls_fingerprint_digest': value => "$postfix_tls_fingerprint_digest";
- }
-
- postfix::config { 'smtp_tls_policy_maps':
- value => 'hash:/etc/postfix/tls_policy',
- require => [
- Postfix::Hash['/etc/postfix/tls_policy'],
- Postfix::Config['smtp_tls_fingerprint_digest'],
- ],
- }
-
-}
diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp
deleted file mode 100644
index 63a50b9..0000000
--- a/manifests/classes/postfix.pp
+++ /dev/null
@@ -1,178 +0,0 @@
-#
-# == Class: postfix
-#
-# This class provides a basic setup of postfix with local and remote
-# delivery and an SMTP server listening on the loopback interface.
-#
-# Parameters:
-# - *$postfix_smtp_listen*: address on which the smtp service will listen to. defaults to 127.0.0.1
-# - *$root_mail_recipient*: who will recieve root's emails. defaults to "nobody"
-#
-# Example usage:
-#
-# node "toto.example.com" {
-# $postfix_smtp_listen = "192.168.1.10"
-# include postfix
-# }
-#
-class postfix {
-
- # 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
- }
- }
-
- # Default value for various options
- case $postfix_smtp_listen {
- "": { $postfix_smtp_listen = "127.0.0.1" }
- }
- case $root_mail_recipient {
- "": { $root_mail_recipient = "nobody" }
- }
- case $postfix_anon_sasl {
- "": { $postfix_anon_sasl = "no" }
- }
- case $postfix_manage_header_checks {
- "": { $postfix_manage_header_checks = "no" }
- }
- case $postfix_manage_tls_policy {
- "": { $postfix_manage_tls_policy = "no" }
- }
- case $postfix_use_amavisd {
- "": { $postfix_use_amavisd = "no" }
- }
- case $postfix_use_dovecot_lda {
- "": { $postfix_use_dovecot_lda = "no" }
- }
- case $postfix_use_schleuder {
- "": { $postfix_use_schleuder = "no" }
- }
- case $postfix_use_sympa {
- "": { $postfix_use_sympa = "no" }
- }
- case $postfix_mastercf_tail {
- "": { $postfix_mastercf_tail = "" }
- }
- case $postfix_inet_interfaces {
- "": { $postfix_inet_interfaces = 'all' }
- }
- case $postfix_myorigin {
- "": { $postfix_myorigin = $fqdn }
- }
-
- # Bootstrap moduledir
- include common::moduledir
- module_dir{'postfix': }
-
- # Include optional classes
- if $postfix_anon_sasl == 'yes' {
- include postfix::anonsasl
- }
- if $postfix_manage_header_checks == 'yes' {
- include postfix::header_checks
- }
- if $postfix_manage_tls_policy == 'yes' {
- include postfix::tlspolicy
- }
- if $postfix_use_amavisd == 'yes' {
- include postfix::amavis
- }
-
- package { ["postfix", "mailx"]:
- ensure => installed
- }
-
- if $operatingsystem == 'debian' {
- Package[mailx] { name => 'bsd-mailx' }
- }
-
- service { "postfix":
- ensure => running,
- require => Package["postfix"],
- }
-
- file { "/etc/mailname":
- ensure => present,
- content => "${fqdn}\n",
- seltype => $postfix_seltype,
- }
-
- # Aliases
- file { "/etc/aliases":
- ensure => present,
- content => "# file managed by puppet\n",
- replace => false,
- seltype => $postfix_seltype,
- notify => Exec["newaliases"],
- }
-
- # Aliases
- exec { "newaliases":
- command => "/usr/bin/newaliases",
- refreshonly => true,
- require => Package["postfix"],
- subscribe => File["/etc/aliases"],
- }
-
- # Config files
- file { "/etc/postfix/master.cf":
- ensure => present,
- owner => "root",
- group => "root",
- mode => "0644",
- content => $operatingsystem ? {
- Redhat => template("postfix/master.cf.redhat5.erb"),
- CentOS => template("postfix/master.cf.redhat5.erb"),
- Debian => template("postfix/master.cf.debian-$lsbdistcodename.erb"),
- Ubuntu => template("postfix/master.cf.debian-etch.erb"),
- },
- seltype => $postfix_seltype,
- notify => Service["postfix"],
- require => Package["postfix"],
- }
-
- # Config files
- file { "/etc/postfix/main.cf":
- ensure => present,
- owner => "root",
- group => "root",
- mode => "0644",
- source => "puppet:///modules/postfix/main.cf",
- replace => false,
- seltype => $postfix_seltype,
- notify => Service["postfix"],
- require => Package["postfix"],
- }
-
- # Default configuration parameters
- postfix::config {
- "myorigin": value => "${postfix_myorigin}";
- "alias_maps": value => "hash:/etc/aliases";
- "inet_interfaces": value => "${postfix_inet_interfaces}";
- }
-
- case $operatingsystem {
- RedHat, CentOS: {
- postfix::config {
- "sendmail_path": value => "/usr/sbin/sendmail.postfix";
- "newaliases_path": value => "/usr/bin/newaliases.postfix";
- "mailq_path": value => "/usr/bin/mailq.postfix";
- }
- }
- }
-
- postfix::mailalias {"root":
- recipient => $root_mail_recipient,
- }
-}