From 77578b93bd98bf0bf9cf69e4fa8da75dcf9c236d Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 16 Feb 2012 16:51:56 +0100 Subject: 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. --- manifests/classes/postfix-amavis.pp | 5 - manifests/classes/postfix-anonsasl.pp | 18 --- manifests/classes/postfix-header_checks.pp | 57 --------- manifests/classes/postfix-mailman.pp | 36 ------ manifests/classes/postfix-mta.pp | 61 ---------- manifests/classes/postfix-satellite.pp | 38 ------ manifests/classes/postfix-tlspolicy.pp | 71 ------------ manifests/classes/postfix.pp | 178 ----------------------------- 8 files changed, 464 deletions(-) delete mode 100644 manifests/classes/postfix-amavis.pp delete mode 100644 manifests/classes/postfix-anonsasl.pp delete mode 100644 manifests/classes/postfix-header_checks.pp delete mode 100644 manifests/classes/postfix-mailman.pp delete mode 100644 manifests/classes/postfix-mta.pp delete mode 100644 manifests/classes/postfix-satellite.pp delete mode 100644 manifests/classes/postfix-tlspolicy.pp delete mode 100644 manifests/classes/postfix.pp (limited to 'manifests/classes') 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, - } -} -- cgit v1.2.3