From 2892a51af739fc4e2f6ae4c6cb05ef3b222a8d25 Mon Sep 17 00:00:00 2001 From: Alex Soto Date: Thu, 1 Sep 2011 08:32:26 -0700 Subject: [PATCH] COOK-733: added postfix::aliases recipe to manage /etc/aliases Signed-off-by: jtimberman --- metadata.rb | 5 +++++ recipes/aliases.rb | 13 +++++++++++++ templates/ubuntu-10.04/aliases.erb | 7 +++++++ 3 files changed, 25 insertions(+) create mode 100644 recipes/aliases.rb create mode 100644 templates/ubuntu-10.04/aliases.erb diff --git a/metadata.rb b/metadata.rb index c8bfc28..a9eb751 100644 --- a/metadata.rb +++ b/metadata.rb @@ -15,6 +15,11 @@ attribute "postfix", :description => "Hash of Postfix attributes", :type => "hash" +attribute "postfix/aliases", + :display_name => "Postfix Aliases", + :description => "Hash of Postfix aliases mapping a name to a value. Example 'root' => 'operator@example.com'. See aliases man page for details.", + :type => "hash" + attribute "postfix/mail_type", :display_name => "Postfix Mail Type", :description => "Is this node a client or server?", diff --git a/recipes/aliases.rb b/recipes/aliases.rb new file mode 100644 index 0000000..30a4891 --- /dev/null +++ b/recipes/aliases.rb @@ -0,0 +1,13 @@ +require_recipe "postfix" + +execute "update-postfix-aliases" do + command "newaliases" + action :nothing +end + +template "/etc/aliases" do + source "aliases.erb" + notifies :run, resources("execute[update-postfix-aliases]") + #notifies :reload, resources(:service => "postfix") +end + diff --git a/templates/ubuntu-10.04/aliases.erb b/templates/ubuntu-10.04/aliases.erb new file mode 100644 index 0000000..658db32 --- /dev/null +++ b/templates/ubuntu-10.04/aliases.erb @@ -0,0 +1,7 @@ +# See man 5 aliases for format +postmaster: root + +<% @node[:postfix][:aliases].each do |name, value| %> +<%= name %>: "<%= value %>" +<% end unless @node[:postfix][:aliases].nil? %> +