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? %> +