diff options
-rw-r--r-- | manifests/amavis.pp (renamed from manifests/classes/postfix-amavis.pp) | 0 | ||||
-rw-r--r-- | manifests/anonsasl.pp (renamed from manifests/classes/postfix-anonsasl.pp) | 0 | ||||
-rw-r--r-- | manifests/classes/postfix.pp | 178 | ||||
-rw-r--r-- | manifests/config.pp (renamed from manifests/definitions/config.pp) | 0 | ||||
-rw-r--r-- | manifests/hash.pp (renamed from manifests/definitions/hash.pp) | 0 | ||||
-rw-r--r-- | manifests/header_checks.pp (renamed from manifests/classes/postfix-header_checks.pp) | 0 | ||||
-rw-r--r-- | manifests/header_checks_snippet.pp (renamed from manifests/definitions/header_checks_snippet.pp) | 0 | ||||
-rw-r--r-- | manifests/init.pp | 180 | ||||
-rw-r--r-- | manifests/mailalias.pp (renamed from manifests/definitions/mailalias.pp) | 0 | ||||
-rw-r--r-- | manifests/mailman.pp (renamed from manifests/classes/postfix-mailman.pp) | 0 | ||||
-rw-r--r-- | manifests/mta.pp (renamed from manifests/classes/postfix-mta.pp) | 0 | ||||
-rw-r--r-- | manifests/satellite.pp (renamed from manifests/classes/postfix-satellite.pp) | 0 | ||||
-rw-r--r-- | manifests/tlspolicy.pp (renamed from manifests/classes/postfix-tlspolicy.pp) | 0 | ||||
-rw-r--r-- | manifests/tlspolicy_snippet.pp (renamed from manifests/definitions/tlspolicy_snippet.pp) | 0 | ||||
-rw-r--r-- | manifests/transport.pp (renamed from manifests/definitions/transport.pp) | 0 | ||||
-rw-r--r-- | manifests/virtual.pp (renamed from manifests/definitions/virtual.pp) | 0 |
16 files changed, 178 insertions, 180 deletions
diff --git a/manifests/classes/postfix-amavis.pp b/manifests/amavis.pp index b663923..b663923 100644 --- a/manifests/classes/postfix-amavis.pp +++ b/manifests/amavis.pp diff --git a/manifests/classes/postfix-anonsasl.pp b/manifests/anonsasl.pp index ca97f19..ca97f19 100644 --- a/manifests/classes/postfix-anonsasl.pp +++ b/manifests/anonsasl.pp 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, - } -} diff --git a/manifests/definitions/config.pp b/manifests/config.pp index 8e203a6..8e203a6 100644 --- a/manifests/definitions/config.pp +++ b/manifests/config.pp diff --git a/manifests/definitions/hash.pp b/manifests/hash.pp index c8bb7c7..c8bb7c7 100644 --- a/manifests/definitions/hash.pp +++ b/manifests/hash.pp diff --git a/manifests/classes/postfix-header_checks.pp b/manifests/header_checks.pp index 071f6b0..071f6b0 100644 --- a/manifests/classes/postfix-header_checks.pp +++ b/manifests/header_checks.pp diff --git a/manifests/definitions/header_checks_snippet.pp b/manifests/header_checks_snippet.pp index 454d219..454d219 100644 --- a/manifests/definitions/header_checks_snippet.pp +++ b/manifests/header_checks_snippet.pp diff --git a/manifests/init.pp b/manifests/init.pp index 6cc1969..63a50b9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,2 +1,178 @@ -import "classes/*.pp" -import "definitions/*.pp" +# +# == 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, + } +} diff --git a/manifests/definitions/mailalias.pp b/manifests/mailalias.pp index cd1af50..cd1af50 100644 --- a/manifests/definitions/mailalias.pp +++ b/manifests/mailalias.pp diff --git a/manifests/classes/postfix-mailman.pp b/manifests/mailman.pp index cba0848..cba0848 100644 --- a/manifests/classes/postfix-mailman.pp +++ b/manifests/mailman.pp diff --git a/manifests/classes/postfix-mta.pp b/manifests/mta.pp index c36c0bc..c36c0bc 100644 --- a/manifests/classes/postfix-mta.pp +++ b/manifests/mta.pp diff --git a/manifests/classes/postfix-satellite.pp b/manifests/satellite.pp index cb92a9f..cb92a9f 100644 --- a/manifests/classes/postfix-satellite.pp +++ b/manifests/satellite.pp diff --git a/manifests/classes/postfix-tlspolicy.pp b/manifests/tlspolicy.pp index 633c380..633c380 100644 --- a/manifests/classes/postfix-tlspolicy.pp +++ b/manifests/tlspolicy.pp diff --git a/manifests/definitions/tlspolicy_snippet.pp b/manifests/tlspolicy_snippet.pp index 2596dbc..2596dbc 100644 --- a/manifests/definitions/tlspolicy_snippet.pp +++ b/manifests/tlspolicy_snippet.pp diff --git a/manifests/definitions/transport.pp b/manifests/transport.pp index 5ca5554..5ca5554 100644 --- a/manifests/definitions/transport.pp +++ b/manifests/transport.pp diff --git a/manifests/definitions/virtual.pp b/manifests/virtual.pp index 8fcd53a..8fcd53a 100644 --- a/manifests/definitions/virtual.pp +++ b/manifests/virtual.pp |