From f9068edca5cd1dfd4348a9285df447a293d287fd Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 9 Jul 2014 23:14:42 +0200 Subject: get rid off lsb facts --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index c7b9ce8..3d51bb1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -59,7 +59,7 @@ class postfix( case $::operatingsystem { RedHat, CentOS: { - case $::lsbmajdistrelease { + case $::operatingsystemmajrelease { "4": { $postfix_seltype = "etc_t" } "5": { $postfix_seltype = "postfix_etc_t" } default: { $postfix_seltype = undef } @@ -143,7 +143,7 @@ class postfix( content => $::operatingsystem ? { Redhat => template("postfix/master.cf.redhat5.erb"), CentOS => template("postfix/master.cf.redhat5.erb"), - Debian => template("postfix/master.cf.debian-${::lsbdistcodename}.erb"), + Debian => template("postfix/master.cf.debian-${::operatingsystemmajrelease}.erb"), Ubuntu => template("postfix/master.cf.debian-etch.erb"), }, seltype => $postfix_seltype, -- cgit v1.2.3 From a61349e001b807f23eea3e4d7d97cd9c83fcd6f9 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sat, 28 Feb 2015 12:08:10 +0000 Subject: Fix usage of the common::module_dir. --- manifests/init.pp | 2 +- manifests/tlspolicy.pp | 2 +- manifests/transport_regexp.pp | 2 +- manifests/virtual_regexp.pp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index 3d51bb1..f454be9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -74,7 +74,7 @@ class postfix( # Bootstrap moduledir include common::moduledir - module_dir{'postfix': } + common::module_dir{'postfix': } # Include optional classes if $anon_sasl == 'yes' { diff --git a/manifests/tlspolicy.pp b/manifests/tlspolicy.pp index e1272b9..d901710 100644 --- a/manifests/tlspolicy.pp +++ b/manifests/tlspolicy.pp @@ -16,7 +16,7 @@ class postfix::tlspolicy( ) { include common::moduledir - module_dir{'postfix/tls_policy': } + common::module_dir{'postfix/tls_policy': } $postfix_tlspolicy_dir = "${common::moduledir::module_dir_path}/postfix/tls_policy" $postfix_merged_tlspolicy = "${postfix_tlspolicy_dir}/merged_tls_policy" diff --git a/manifests/transport_regexp.pp b/manifests/transport_regexp.pp index eaa78da..4961141 100644 --- a/manifests/transport_regexp.pp +++ b/manifests/transport_regexp.pp @@ -22,7 +22,7 @@ class postfix::transport_regexp { include common::moduledir - module_dir{'postfix/transport_regexp': } + common::module_dir{'postfix/transport_regexp': } $postfix_transport_regexp_dir = "${common::moduledir::module_dir_path}/postfix/transport_regexp" $postfix_transport_regexp_snippets_dir = "${postfix_transport_regexp_dir}/transport_regexp.d" diff --git a/manifests/virtual_regexp.pp b/manifests/virtual_regexp.pp index af68ec6..18bbd8c 100644 --- a/manifests/virtual_regexp.pp +++ b/manifests/virtual_regexp.pp @@ -22,7 +22,7 @@ class postfix::virtual_regexp { include common::moduledir - module_dir{'postfix/virtual_regexp': } + common::module_dir{'postfix/virtual_regexp': } $postfix_virtual_regexp_dir = "${common::moduledir::module_dir_path}/postfix/virtual_regexp" $postfix_virtual_regexp_snippets_dir = "${postfix_virtual_regexp_dir}/virtual_regexp.d" -- cgit v1.2.3 From 58c687dcaa5c24d3258b34a2a75e7a964431fd91 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 21 Aug 2015 17:09:58 -0700 Subject: make default value for alias_maps optional --- manifests/init.pp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index f454be9..4a7ca72 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,7 +52,8 @@ class postfix( $use_smtps = "no", $mastercf_tail = "", $inet_interfaces = 'all', - $myorigin = $::fqdn + $myorigin = $::fqdn, + $default_alias_maps = true ) { # selinux labels differ from one distribution to another @@ -165,9 +166,13 @@ class postfix( } # Default configuration parameters + if $default_alias_maps { + postfix::config { + "alias_maps": value => "hash:/etc/aliases"; + } + } postfix::config { - "myorigin": value => "${myorigin}"; - "alias_maps": value => "hash:/etc/aliases"; + "myorigin": value => "${myorigin}"; "inet_interfaces": value => "${inet_interfaces}"; } -- cgit v1.2.3 From 1eea47c2f6b8f0290fb27558eb873563fc99758b Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 1 Dec 2015 14:44:38 +0100 Subject: linted init.pp --- manifests/init.pp | 110 +++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index 4a7ca72..54f36e5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -34,23 +34,23 @@ # } # class postfix( - $smtp_listen = "127.0.0.1", - $root_mail_recipient = "nobody", - $anon_sasl = "no", - $manage_header_checks = "no", - $manage_tls_policy = "no", - $manage_transport_regexp = "no", - $manage_virtual_regexp = "no", + $smtp_listen = '127.0.0.1', + $root_mail_recipient = 'nobody', + $anon_sasl = 'no', + $manage_header_checks = 'no', + $manage_tls_policy = 'no', + $manage_transport_regexp = 'no', + $manage_virtual_regexp = 'no', $tls_fingerprint_digest = 'sha1', - $use_amavisd = "no", - $use_dovecot_lda = "no", - $use_schleuder = "no", - $use_sympa = "no", - $use_firma = "no", - $use_mlmmj = "no", - $use_submission = "no", - $use_smtps = "no", - $mastercf_tail = "", + $use_amavisd = 'no', + $use_dovecot_lda = 'no', + $use_schleuder = 'no', + $use_sympa = 'no', + $use_firma = 'no', + $use_mlmmj = 'no', + $use_submission = 'no', + $use_smtps = 'no', + $mastercf_tail = '', $inet_interfaces = 'all', $myorigin = $::fqdn, $default_alias_maps = true @@ -61,8 +61,8 @@ class postfix( RedHat, CentOS: { case $::operatingsystemmajrelease { - "4": { $postfix_seltype = "etc_t" } - "5": { $postfix_seltype = "postfix_etc_t" } + '4': { $postfix_seltype = 'etc_t' } + '5': { $postfix_seltype = 'postfix_etc_t' } default: { $postfix_seltype = undef } } } @@ -81,7 +81,8 @@ class postfix( if $anon_sasl == 'yes' { include postfix::anonsasl } - if $header_checks == 'yes' { + # this global variable needs to get parameterized as well + if $::header_checks == 'yes' { include postfix::header_checks } if $manage_tls_policy == 'yes' { @@ -99,7 +100,7 @@ class postfix( include postfix::virtual_regexp } - package { ["postfix", "mailx"]: + package { ['postfix', 'mailx']: ensure => installed } @@ -107,86 +108,87 @@ class postfix( Package[mailx] { name => 'bsd-mailx' } } - service { "postfix": + service { 'postfix': ensure => running, - require => Package["postfix"], + require => Package['postfix'], } - file { "/etc/mailname": + file { '/etc/mailname': ensure => present, - content => "${fqdn}\n", + content => "${::fqdn}\n", seltype => $postfix_seltype, } # Aliases - file { "/etc/aliases": - ensure => present, + file { '/etc/aliases': + ensure => present, content => "# file managed by puppet\n", replace => false, seltype => $postfix_seltype, - notify => Exec["newaliases"], + notify => Exec['newaliases'], } # Aliases - exec { "newaliases": - command => "/usr/bin/newaliases", + exec { 'newaliases': + command => '/usr/bin/newaliases', refreshonly => true, - require => Package["postfix"], - subscribe => File["/etc/aliases"], + require => Package['postfix'], + subscribe => File['/etc/aliases'], } # Config files - file { "/etc/postfix/master.cf": + file { '/etc/postfix/master.cf': ensure => present, - owner => "root", - group => "root", - mode => "0644", + owner => 'root', + group => 'root', + mode => '0644', content => $::operatingsystem ? { - Redhat => template("postfix/master.cf.redhat5.erb"), - CentOS => template("postfix/master.cf.redhat5.erb"), + Redhat => template('postfix/master.cf.redhat5.erb'), + CentOS => template('postfix/master.cf.redhat5.erb'), Debian => template("postfix/master.cf.debian-${::operatingsystemmajrelease}.erb"), - Ubuntu => template("postfix/master.cf.debian-etch.erb"), + Ubuntu => template('postfix/master.cf.debian-etch.erb'), }, seltype => $postfix_seltype, - notify => Service["postfix"], - require => Package["postfix"], + notify => Service['postfix'], + require => Package['postfix'], } # Config files - file { "/etc/postfix/main.cf": + file { '/etc/postfix/main.cf': ensure => present, - owner => "root", - group => "root", - mode => "0644", - source => "puppet:///modules/postfix/main.cf", + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/postfix/main.cf', replace => false, seltype => $postfix_seltype, - notify => Service["postfix"], - require => Package["postfix"], + notify => Service['postfix'], + require => Package['postfix'], } # Default configuration parameters if $default_alias_maps { postfix::config { - "alias_maps": value => "hash:/etc/aliases"; + 'alias_maps': value => 'hash:/etc/aliases'; } } postfix::config { - "myorigin": value => "${myorigin}"; - "inet_interfaces": value => "${inet_interfaces}"; + 'myorigin': value => $myorigin; + 'inet_interfaces': value => $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"; + 'sendmail_path': value => '/usr/sbin/sendmail.postfix'; + 'newaliases_path': value => '/usr/bin/newaliases.postfix'; + 'mailq_path': value => '/usr/bin/mailq.postfix'; } } + default: {} } - postfix::mailalias {"root": + postfix::mailalias {'root': recipient => $root_mail_recipient, } } -- cgit v1.2.3 From f4201357e5da4cbdecd558218c262c01d92c4697 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 1 Dec 2015 14:50:56 +0100 Subject: [refactor] Dont use case statement in resource def --- manifests/init.pp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index 54f36e5..f92e20b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -56,10 +56,12 @@ class postfix( $default_alias_maps = true ) { - # selinux labels differ from one distribution to another case $::operatingsystem { RedHat, CentOS: { + $master_cf_template = 'postfix/master.cf.redhat5.erb' + + # selinux labels differ from one distribution to another case $::operatingsystemmajrelease { '4': { $postfix_seltype = 'etc_t' } '5': { $postfix_seltype = 'postfix_etc_t' } @@ -67,8 +69,17 @@ class postfix( } } + 'Debian': { + $master_cf_template = "postfix/master.cf.debian-${::operatingsystemmajrelease}.erb" + } + + 'Ubuntu': { + $master_cf_template = 'postfix/master.cf.debian-sid.erb' + } + default: { - $postfix_seltype = undef + $postfix_seltype = undef + $master_cf_template = undef } } @@ -142,12 +153,7 @@ class postfix( 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-${::operatingsystemmajrelease}.erb"), - Ubuntu => template('postfix/master.cf.debian-etch.erb'), - }, + content => template($master_cf_template), seltype => $postfix_seltype, notify => Service['postfix'], require => Package['postfix'], -- cgit v1.2.3 From 969076a813b88dafd222c413bf6fbabab837eafb Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 1 Dec 2015 16:27:41 +0100 Subject: join case statements in init.pp --- manifests/init.pp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index f92e20b..d298183 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -58,7 +58,7 @@ class postfix( case $::operatingsystem { - RedHat, CentOS: { + 'RedHat', 'CentOS': { $master_cf_template = 'postfix/master.cf.redhat5.erb' # selinux labels differ from one distribution to another @@ -67,6 +67,12 @@ class postfix( '5': { $postfix_seltype = 'postfix_etc_t' } default: { $postfix_seltype = undef } } + + postfix::config { + 'sendmail_path': value => '/usr/sbin/sendmail.postfix'; + 'newaliases_path': value => '/usr/bin/newaliases.postfix'; + 'mailq_path': value => '/usr/bin/mailq.postfix'; + } } 'Debian': { @@ -183,17 +189,6 @@ class postfix( 'inet_interfaces': value => $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'; - } - } - default: {} - } - postfix::mailalias {'root': recipient => $root_mail_recipient, } -- cgit v1.2.3