From cab934f909690ce57e222a2ed5d6a53c74679191 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 10 Nov 2011 13:51:55 -0500 Subject: add dovecot::config::file to be able to handle the different /etc/dovecot/conf.d files (similar to nginx/apache module) --- manifests/config/file.pp | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 manifests/config/file.pp (limited to 'manifests/config/file.pp') diff --git a/manifests/config/file.pp b/manifests/config/file.pp new file mode 100644 index 0000000..78e6a28 --- /dev/null +++ b/manifests/config/file.pp @@ -0,0 +1,60 @@ +define dovecot::config::file ( + $ensure = present, + $source = 'absent', + $content = 'absent', + $destination = 'absent' +) + { + + # the default destination is 'absent', so if the user doesn't specify a + # destination, then we use the following defaults. If different systems + # implement different locations, we can trigger here off of operatingsystem + # and change the 'config_dir' path in base.pp to just be /etc/dovecot + $real_destination = $destination ? { + 'absent' => "${config_dir}/${name}", + default => $destination + } + + # the $name variable is set to dovecot_${name}, but the actual filename will + # be set to $name + file { "dovecot_${name}": + ensure => $ensure, + path => $real_destination, + notify => Service[dovecot], + owner => root, group => 0, mode => 0640; + } + + # the $content variable is 'absent' by default, so if the user doesn't + # specify anything for $content, then the following will be used, searching + # from the first source line until a file is found that matches. We use the + # standard search prioritizing the site-dovecot module first + case $content { + 'absent': { + $real_source = $source ? { + 'absent' => [ + "puppet:///modules/site-dovecot/config/${fqdn}/${name}", + "puppet:///modules/site-dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", + "puppet:///modules/site-dovecot/config/${operatingsystem}/${name}", + "puppet:///modules/site-dovecot/config/${name}", + "puppet:///modules/dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", + "puppet:///modules/dovecot/config/${operatingsystem}/${name}", + "puppet:///modules/dovecot/config/${name}" + ], + default => "puppet:///${source}", + } + File["dovecot_${name}"]{ + source => $real_source, + } + } + default: { + File["dovecot_${name}"]{ + content => $content, + } + } + } + File["dovecot_${name}"]{ + require => Package[dovecot], + } + } + + -- cgit v1.2.3 From 4694e77991dadf1bcc54fd9ff5b7651fcc6fc87d Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sun, 13 Nov 2011 12:23:45 -0500 Subject: set a default destination --- manifests/config/file.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/config/file.pp') diff --git a/manifests/config/file.pp b/manifests/config/file.pp index 78e6a28..fe93500 100644 --- a/manifests/config/file.pp +++ b/manifests/config/file.pp @@ -11,7 +11,7 @@ define dovecot::config::file ( # implement different locations, we can trigger here off of operatingsystem # and change the 'config_dir' path in base.pp to just be /etc/dovecot $real_destination = $destination ? { - 'absent' => "${config_dir}/${name}", + 'absent' => "/etc/dovecot/conf.d/${name}", default => $destination } -- cgit v1.2.3 From 5226583c8c6ecd74d0621b2b61e56ab9f98bcb6c Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 14 Nov 2011 11:42:58 -0500 Subject: allow for overriding the owner/group/mode of dovecot config files In some cases, the default permissions will not work. For example, if you are using postfix's pipe to send things through dovecot's LDA with sieve for filtering, you will get this: dovecot-lda: Permission denied doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 17: Couldn't open include file /etc/dovecot/conf.d/90-sieve.conf: Permission denied that is because, by default, the process runs as user 'mail' --- manifests/config/file.pp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'manifests/config/file.pp') diff --git a/manifests/config/file.pp b/manifests/config/file.pp index fe93500..39c6cc3 100644 --- a/manifests/config/file.pp +++ b/manifests/config/file.pp @@ -2,7 +2,10 @@ define dovecot::config::file ( $ensure = present, $source = 'absent', $content = 'absent', - $destination = 'absent' + $destination = 'absent', + $mode = 'absent', + $owner = 'absent', + $group = 'absent' ) { @@ -15,13 +18,28 @@ define dovecot::config::file ( default => $destination } + $real_mode = $mode ? { + 'absent' => 0640, + default => $mode + } + + $real_owner = $owner ? { + 'absent' => root, + default => $owner + } + + $real_group = $group ? { + 'absent' => 0, + default => $group + } + # the $name variable is set to dovecot_${name}, but the actual filename will # be set to $name file { "dovecot_${name}": ensure => $ensure, path => $real_destination, notify => Service[dovecot], - owner => root, group => 0, mode => 0640; + owner => $real_owner, group => $real_group, mode => $real_mode; } # the $content variable is 'absent' by default, so if the user doesn't -- cgit v1.2.3 From dca386b40c22892245e0a8b9b6ab4853fca1412a Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 27 Jun 2012 12:18:10 -0400 Subject: switch to 2.7 requirement of underscores instead of hyphens --- manifests/config/file.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'manifests/config/file.pp') diff --git a/manifests/config/file.pp b/manifests/config/file.pp index 39c6cc3..0fe777f 100644 --- a/manifests/config/file.pp +++ b/manifests/config/file.pp @@ -45,15 +45,15 @@ define dovecot::config::file ( # the $content variable is 'absent' by default, so if the user doesn't # specify anything for $content, then the following will be used, searching # from the first source line until a file is found that matches. We use the - # standard search prioritizing the site-dovecot module first + # standard search prioritizing the site_dovecot module first case $content { 'absent': { $real_source = $source ? { 'absent' => [ - "puppet:///modules/site-dovecot/config/${fqdn}/${name}", - "puppet:///modules/site-dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", - "puppet:///modules/site-dovecot/config/${operatingsystem}/${name}", - "puppet:///modules/site-dovecot/config/${name}", + "puppet:///modules/site_dovecot/config/${fqdn}/${name}", + "puppet:///modules/site_dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", + "puppet:///modules/site_dovecot/config/${operatingsystem}/${name}", + "puppet:///modules/site_dovecot/config/${name}", "puppet:///modules/dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", "puppet:///modules/dovecot/config/${operatingsystem}/${name}", "puppet:///modules/dovecot/config/${name}" -- cgit v1.2.3 From 0c57b954d1b33da8d6b44bb45db0dd71dd929ee5 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 9 Dec 2013 19:52:46 -0500 Subject: some linting, and make the 'config_dir' name be more specifically 'dovecot_config_dir' to not be greedy in the namespace --- manifests/config/file.pp | 126 +++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 64 deletions(-) (limited to 'manifests/config/file.pp') diff --git a/manifests/config/file.pp b/manifests/config/file.pp index 0fe777f..e6e93c3 100644 --- a/manifests/config/file.pp +++ b/manifests/config/file.pp @@ -7,72 +7,70 @@ define dovecot::config::file ( $owner = 'absent', $group = 'absent' ) - { +{ - # the default destination is 'absent', so if the user doesn't specify a - # destination, then we use the following defaults. If different systems - # implement different locations, we can trigger here off of operatingsystem - # and change the 'config_dir' path in base.pp to just be /etc/dovecot - $real_destination = $destination ? { - 'absent' => "/etc/dovecot/conf.d/${name}", - default => $destination - } + # the default destination is 'absent', so if the user doesn't specify a + # destination, then we use the following defaults. If different systems + # implement different locations, we can trigger here off of operatingsystem + # and change the 'dovecot_config_dir' path in base.pp to just be /etc/dovecot + $real_destination = $destination ? { + 'absent' => "/etc/dovecot/conf.d/${name}", + default => $destination + } - $real_mode = $mode ? { - 'absent' => 0640, - default => $mode - } + $real_mode = $mode ? { + 'absent' => 0640, + default => $mode + } - $real_owner = $owner ? { - 'absent' => root, - default => $owner - } + $real_owner = $owner ? { + 'absent' => root, + default => $owner + } - $real_group = $group ? { - 'absent' => 0, - default => $group - } - - # the $name variable is set to dovecot_${name}, but the actual filename will - # be set to $name - file { "dovecot_${name}": - ensure => $ensure, - path => $real_destination, - notify => Service[dovecot], - owner => $real_owner, group => $real_group, mode => $real_mode; - } + $real_group = $group ? { + 'absent' => 0, + default => $group + } - # the $content variable is 'absent' by default, so if the user doesn't - # specify anything for $content, then the following will be used, searching - # from the first source line until a file is found that matches. We use the - # standard search prioritizing the site_dovecot module first - case $content { - 'absent': { - $real_source = $source ? { - 'absent' => [ - "puppet:///modules/site_dovecot/config/${fqdn}/${name}", - "puppet:///modules/site_dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", - "puppet:///modules/site_dovecot/config/${operatingsystem}/${name}", - "puppet:///modules/site_dovecot/config/${name}", - "puppet:///modules/dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", - "puppet:///modules/dovecot/config/${operatingsystem}/${name}", - "puppet:///modules/dovecot/config/${name}" - ], - default => "puppet:///${source}", - } - File["dovecot_${name}"]{ - source => $real_source, - } - } - default: { - File["dovecot_${name}"]{ - content => $content, - } - } - } - File["dovecot_${name}"]{ - require => Package[dovecot], - } - } - - + # the $name variable is set to dovecot_${name}, but the actual filename will + # be set to $name + file { "dovecot_${name}": + ensure => $ensure, + path => $real_destination, + notify => Service[dovecot], + owner => $real_owner, group => $real_group, mode => $real_mode; + } + + # the $content variable is 'absent' by default, so if the user doesn't + # specify anything for $content, then the following will be used, searching + # from the first source line until a file is found that matches. We use the + # standard search prioritizing the site_dovecot module first + case $content { + 'absent': { + $real_source = $source ? { + 'absent' => [ + "puppet:///modules/site_dovecot/config/${fqdn}/${name}", + "puppet:///modules/site_dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", + "puppet:///modules/site_dovecot/config/${operatingsystem}/${name}", + "puppet:///modules/site_dovecot/config/${name}", + "puppet:///modules/dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}", + "puppet:///modules/dovecot/config/${operatingsystem}/${name}", + "puppet:///modules/dovecot/config/${name}" + ], + default => "puppet:///${source}", + } + File["dovecot_${name}"]{ + source => $real_source, + } + } + default: { + File["dovecot_${name}"]{ + content => $content, + } + } + } + File["dovecot_${name}"]{ + require => Package[dovecot], + } +} -- cgit v1.2.3