From 09d0e1772b47ff87fa120559f9439e8eb893400f Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Tue, 19 Aug 2014 18:32:01 +0200 Subject: [PATCH] Fix for issue #81 --- README.md | 22 +++++++++++++++++++++- attributes/default.rb | 16 ++++++++-------- recipes/default.rb | 8 ++++---- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a92f6eb..676d014 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,14 @@ See `attributes/default.rb` for default values. * `node['postfix']['relayhost_role']` - name of a role used for search in the client recipe. * `node['postfix']['multi_environment_relay']` - set to true if nodes should not constrain search for the relayhost in their own environment. * `node['postfix']['use_procmail']` - set to true if nodes should use procmail as the delivery agent. +* `node['postfix']['use_alias_maps']` - set to true if you want the cookbook to use/configure alias maps +* `node['postfix']['use_transport_maps']` - set to true if you want the cookbook to use/configure transport maps +* `node['postfix']['use_access_maps']` - set to true if you want the cookbook to use/configure access maps +* `node['postfix']['use_virtual_aliases']` - set to true if you want the cookbook to use/configure virtual alias maps * `node['postfix']['aliases']` - hash of aliases to create with `recipe[postfix::aliases]`, see below under __Recipes__ for more information. +* `node['postfix']['transports']` - hash of transports to create with `recipe[postfix::transports]`, see below under __Recipes__ for more information. +* `node['postfix']['access']` - hash of access to create with `recipe[postfix::access]`, see below under __Recipes__ for more information. +* `node['postfix']['virtual_aliases']` - hash of virtual_aliases to create with `recipe[postfix::virtual_aliases]`, see below under __Recipes__ for more information. * `node['postfix']['main_template_source']` - Cookbook source for main.cf template. Default 'postfix' * `node['postfix']['master_template_source']` - Cookbook source for master.cf template. Default 'postfix' @@ -78,7 +85,7 @@ Example of json role config, for setup *_map_entries: Recipes ------- ### default -Installs the postfix package and manages the service and the main configuration files (`/etc/postfix/main.cf` and `/etc/postfix/master.cf`). See __Usage__ and __Examples__ to see how to affect behavior of this recipe through configuration. +Installs the postfix package and manages the service and the main configuration files (`/etc/postfix/main.cf` and `/etc/postfix/master.cf`). See __Usage__ and __Examples__ to see how to affect behavior of this recipe through configuration. Depending on the `node['postfix']['use_alias_maps']`, `node['postfix']['use_transport_maps']`, `node['postfix']['use_access_maps']` and `node['postfix']['use_virtual_aliases']` attributes the default recipe can call additional recipes to manage additional postfix configuration files For a more dynamic approach to discovery for the relayhost, see the `client` and `server` recipes below. @@ -102,6 +109,19 @@ Manage `/etc/aliases` with this recipe. Currently only Ubuntu 10.04 platform has Arrays are supported as alias values, since postfix supports comma separated values per alias, simply specify your alias as an array to use this handy feature. +### aliases +Manage `/etc/aliases` with this recipe. + +### transports +Manage `/etc/postfix/transport` with this recipe. + +### access +Manage `/etc/postfix/access` with this recipe. + +### virtual_aliases +Manage `/etc/postfix/virtual` with this recipe. + + http://wiki.opscode.com/display/chef/Templates#Templates-TemplateLocationSpecificity diff --git a/attributes/default.rb b/attributes/default.rb index 0e1f5e6..1dcaebb 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,6 +20,10 @@ default['postfix']['mail_type'] = 'client' default['postfix']['relayhost_role'] = 'relayhost' default['postfix']['multi_environment_relay'] = false default['postfix']['use_procmail'] = false +default['postfix']['use_alias_maps'] = false +default['postfix']['use_transport_maps'] = false +default['postfix']['use_access_maps'] = false +default['postfix']['use_virtual_aliases'] = false default['postfix']['aliases'] = {} default['postfix']['transports'] = {} default['postfix']['access'] = {} @@ -61,10 +65,6 @@ default['postfix']['main']['mydestination'] = [node['postfix']['main']['myhostna default['postfix']['main']['smtpd_use_tls'] = 'yes' default['postfix']['main']['smtp_use_tls'] = 'yes' default['postfix']['main']['smtp_sasl_auth_enable'] = 'no' -default['postfix']['main']['use_alias_maps'] = 'no' -default['postfix']['main']['use_transport_maps'] = 'no' -default['postfix']['main']['use_access_maps'] = 'no' -default['postfix']['main']['use_virtual_aliases'] = 'no' default['postfix']['main']['mailbox_size_limit'] = 0 default['postfix']['main']['mynetworks'] = nil default['postfix']['main']['inet_interfaces'] = 'loopback-only' @@ -106,19 +106,19 @@ if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes' default['postfix']['main']['relayhost'] = '' end -if node['postfix']['main']['use_alias_maps'] == 'yes' +if node['postfix']['use_alias_maps'] default['postfix']['main']['alias_maps'] = ["hash:#{node['postfix']['aliases_db']}"] end -if node['postfix']['main']['use_transport_maps'] == 'yes' +if node['postfix']['use_transport_maps'] default['postfix']['main']['transport_maps'] = ["hash:#{node['postfix']['transport_db']}"] end -if node['postfix']['main']['use_access_maps'] == 'yes' +if node['postfix']['use_access_maps'] default['postfix']['main']['access_maps'] = ["hash:#{node['postfix']['access_db']}"] end -if node['postfix']['main']['use_virtual_aliases'] == 'yes' +if node['postfix']['use_virtual_aliases'] default['postfix']['main']['virtual_alias_maps'] = ["hash:#{node['postfix']['virtual_alias_db']}"] end diff --git a/recipes/default.rb b/recipes/default.rb index f09ed95..961917a 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -24,18 +24,18 @@ if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes' include_recipe 'postfix::sasl_auth' end -if node['postfix']['main']['use_alias_maps'] == 'yes' +if node['postfix']['use_alias_maps'] include_recipe 'postfix::aliases' end -if node['postfix']['main']['use_transport_maps'] == 'yes' +if node['postfix']['use_transport_maps'] include_recipe 'postfix::transports' end -if node['postfix']['main']['use_access_maps'] == 'yes' +if node['postfix']['use_access_maps'] include_recipe 'postfix::access' end -if node['postfix']['main']['use_virtual_aliases'] == 'yes' +if node['postfix']['use_virtual_aliases'] include_recipe 'postfix::virtual_aliases' end