Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed conflict:
	manifests/hash.pp
  • Loading branch information
hakamadare committed Apr 4, 2012
2 parents f35ea94 + ac3aed9 commit 89d2bf5
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 270 deletions.
68 changes: 34 additions & 34 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
/*
== Definition: postfix::config
Uses the "postconf" command to add/alter/remove options in postfix main
configuation file (/etc/postfix/main.cf).
Parameters:
- *name*: name of the parameter.
- *ensure*: present/absent. defaults to present.
- *value*: value of the parameter.
Requires:
- Class["postfix"]
Example usage:
node "toto.example.com" {
include postfix
postfix::config {
"smtp_use_tls" => "yes";
"smtp_sasl_auth_enable" => "yes";
"smtp_sasl_password_maps" => "hash:/etc/postfix/my_sasl_passwords";
"relayhost" => "[mail.example.com]:587";
}
}
*/
define postfix::config ($ensure = present, $value) {
#
#== Definition: postfix::config
#
#Uses the "postconf" command to add/alter/remove options in postfix main
#configuation file (/etc/postfix/main.cf).
#
#Parameters:
#- *name*: name of the parameter.
#- *ensure*: present/absent. defaults to present.
#- *value*: value of the parameter.
#
#Requires:
#- Class["postfix"]
#
#Example usage:
#
# node "toto.example.com" {
#
# include postfix
#
# postfix::config {
# "smtp_use_tls" => "yes";
# "smtp_sasl_auth_enable" => "yes";
# "smtp_sasl_password_maps" => "hash:/etc/postfix/my_sasl_passwords";
# "relayhost" => "[mail.example.com]:587";
# }
# }
#
#
define postfix::config ($value, $ensure = present) {

Augeas {
context => "/files/etc/postfix/main.cf",
notify => Service["postfix"],
require => File["/etc/postfix/main.cf"],
context => '/files/etc/postfix/main.cf',
notify => Service['postfix'],
require => File['/etc/postfix/main.cf'],
}

case $ensure {
Expand All @@ -41,11 +41,11 @@
changes => "set $name $value",
}
}

absent: {
augeas { "rm postfix '${name}'":
changes => "rm $name",
}
}
default: {}
}
}
89 changes: 44 additions & 45 deletions manifests/hash.pp
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
/*
== Definition: postfix::hash
Creates postfix hashed "map" files. It will create "${name}", and then build
"${name}.db" using the "postmap" command. The map file can then be referred to
using postfix::config.
Parameters:
- *name*: the name of the map file.
- *ensure*: present/absent, defaults to present.
- *source*: file source.
Requires:
- Class["postfix"]
Example usage:
node "toto.example.com" {
include postfix
postfix::hash { "/etc/postfix/virtual":
ensure => present,
}
postfix::config { "virtual_alias_maps":
value => "hash:/etc/postfix/virtual"
}
}
*/
define postfix::hash ($ensure="present", $source = false) {
#== Definition: postfix::hash
#
#Creates postfix hashed "map" files. It will create "${name}", and then build
#"${name}.db" using the "postmap" command. The map file can then be referred to
#using postfix::config.
#
#Parameters:
#- *name*: the name of the map file.
#- *ensure*: present/absent, defaults to present.
#- *source*: file source.
#
#Requires:
#- Class["postfix"]
#
#Example usage:
#
# node "toto.example.com" {
#
# include postfix
#
# postfix::hash { "/etc/postfix/virtual":
# ensure => present,
# }
# postfix::config { "virtual_alias_maps":
# value => "hash:/etc/postfix/virtual"
# }
# }
#
define postfix::hash ($ensure='present', $source = false) {

# selinux labels differ from one distribution to another
case $operatingsystem {
case $::operatingsystem {

RedHat, CentOS: {
case $lsbmajdistrelease {
"4": { $postfix_seltype = "etc_t" }
"5","6": { $postfix_seltype = "postfix_etc_t" }
case $::lsbmajdistrelease {
'4': { $postfix_seltype = 'etc_t' }
'5','6': { $postfix_seltype = 'postfix_etc_t' }
default: { $postfix_seltype = undef }
}
}
Expand All @@ -48,39 +46,40 @@

case $source {
false: {
file {"${name}":
file {$name:
ensure => $ensure,
mode => 600,
mode => '0600',
owner => root,
group => root,
seltype => $postfix_seltype,
require => Package["postfix"],
require => Package['postfix'],
}
}
default: {
file {"${name}":
file {$name:
ensure => $ensure,
mode => 600,
mode => '0600',
owner => root,
group => root,
source => $source,
seltype => $postfix_seltype,
require => Package["postfix"],
require => Package['postfix'],
}
}
}

file {"${name}.db":
ensure => $ensure,
mode => 600,
require => [File["${name}"], Exec["generate ${name}.db"]],
mode => '0600',
require => [File[$name], Exec["generate ${name}.db"]],
seltype => $postfix_seltype,
}

exec {"generate ${name}.db":
command => "postmap ${name}",
subscribe => File["${name}"],
#creates => "${name}.db", # this prevents postmap from being run !
subscribe => File[$name],
refreshonly => true,
require => Package["postfix"],
require => Package['postfix'],
}
}
Loading

0 comments on commit 89d2bf5

Please sign in to comment.