Use proper variable scope
Facts should be addressed with $::fqdn and so on.
This commit is contained in:
parent
77578b93bd
commit
2c86670a92
3 changed files with 11 additions and 27 deletions
|
@ -29,23 +29,7 @@ Example usage:
|
||||||
|
|
||||||
*/
|
*/
|
||||||
define postfix::hash ($ensure="present", $source = false) {
|
define postfix::hash ($ensure="present", $source = false) {
|
||||||
|
include ::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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case $source {
|
case $source {
|
||||||
false: {
|
false: {
|
||||||
file {"${name}":
|
file {"${name}":
|
||||||
|
@ -53,7 +37,7 @@ define postfix::hash ($ensure="present", $source = false) {
|
||||||
mode => 600,
|
mode => 600,
|
||||||
owner => root,
|
owner => root,
|
||||||
group => root,
|
group => root,
|
||||||
seltype => $postfix_seltype,
|
seltype => $postfix::postfix_seltype,
|
||||||
require => Package["postfix"],
|
require => Package["postfix"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +48,7 @@ define postfix::hash ($ensure="present", $source = false) {
|
||||||
owner => root,
|
owner => root,
|
||||||
group => root,
|
group => root,
|
||||||
source => $source,
|
source => $source,
|
||||||
seltype => $postfix_seltype,
|
seltype => $postfix::postfix_seltype,
|
||||||
require => Package["postfix"],
|
require => Package["postfix"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +58,7 @@ define postfix::hash ($ensure="present", $source = false) {
|
||||||
ensure => $ensure,
|
ensure => $ensure,
|
||||||
mode => 600,
|
mode => 600,
|
||||||
require => [File["${name}"], Exec["generate ${name}.db"]],
|
require => [File["${name}"], Exec["generate ${name}.db"]],
|
||||||
seltype => $postfix_seltype,
|
seltype => $postfix::postfix_seltype,
|
||||||
}
|
}
|
||||||
|
|
||||||
exec {"generate ${name}.db":
|
exec {"generate ${name}.db":
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
class postfix {
|
class postfix {
|
||||||
|
|
||||||
# selinux labels differ from one distribution to another
|
# selinux labels differ from one distribution to another
|
||||||
case $operatingsystem {
|
case $::operatingsystem {
|
||||||
|
|
||||||
RedHat, CentOS: {
|
RedHat, CentOS: {
|
||||||
case $lsbmajdistrelease {
|
case $::lsbmajdistrelease {
|
||||||
"4": { $postfix_seltype = "etc_t" }
|
"4": { $postfix_seltype = "etc_t" }
|
||||||
"5": { $postfix_seltype = "postfix_etc_t" }
|
"5": { $postfix_seltype = "postfix_etc_t" }
|
||||||
default: { $postfix_seltype = undef }
|
default: { $postfix_seltype = undef }
|
||||||
|
@ -93,7 +93,7 @@ class postfix {
|
||||||
ensure => installed
|
ensure => installed
|
||||||
}
|
}
|
||||||
|
|
||||||
if $operatingsystem == 'debian' {
|
if $::operatingsystem == 'debian' {
|
||||||
Package[mailx] { name => 'bsd-mailx' }
|
Package[mailx] { name => 'bsd-mailx' }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,10 +131,10 @@ class postfix {
|
||||||
owner => "root",
|
owner => "root",
|
||||||
group => "root",
|
group => "root",
|
||||||
mode => "0644",
|
mode => "0644",
|
||||||
content => $operatingsystem ? {
|
content => $::operatingsystem ? {
|
||||||
Redhat => template("postfix/master.cf.redhat5.erb"),
|
Redhat => template("postfix/master.cf.redhat5.erb"),
|
||||||
CentOS => 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-${::lsbdistcodename}.erb"),
|
||||||
Ubuntu => template("postfix/master.cf.debian-etch.erb"),
|
Ubuntu => template("postfix/master.cf.debian-etch.erb"),
|
||||||
},
|
},
|
||||||
seltype => $postfix_seltype,
|
seltype => $postfix_seltype,
|
||||||
|
@ -162,7 +162,7 @@ class postfix {
|
||||||
"inet_interfaces": value => "${postfix_inet_interfaces}";
|
"inet_interfaces": value => "${postfix_inet_interfaces}";
|
||||||
}
|
}
|
||||||
|
|
||||||
case $operatingsystem {
|
case $::operatingsystem {
|
||||||
RedHat, CentOS: {
|
RedHat, CentOS: {
|
||||||
postfix::config {
|
postfix::config {
|
||||||
"sendmail_path": value => "/usr/sbin/sendmail.postfix";
|
"sendmail_path": value => "/usr/sbin/sendmail.postfix";
|
||||||
|
|
|
@ -25,7 +25,7 @@ class postfix::satellite {
|
||||||
|
|
||||||
# If $valid_fqdn exists, use it to override $fqdn
|
# If $valid_fqdn exists, use it to override $fqdn
|
||||||
case $valid_fqdn {
|
case $valid_fqdn {
|
||||||
"": { $valid_fqdn = $fqdn }
|
"": { $valid_fqdn = $::fqdn }
|
||||||
default: { $fqdn = "${valid_fqdn}" }
|
default: { $fqdn = "${valid_fqdn}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue