summaryrefslogtreecommitdiff
path: root/puppet/modules/site_postfix/templates
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-09-11 10:35:09 -0700
committerelijah <elijah@riseup.net>2015-09-11 10:35:09 -0700
commit12f94bca6b7b33b2a83883df9434adb6f290e757 (patch)
tree311eeeffda6658c0f723d7021200c05a1e926e7f /puppet/modules/site_postfix/templates
parentc0c06c6be819126cec6adb359a7e52c95f51defe (diff)
parent702bf139f407d60e7c297ceb67fc6c30fead1e61 (diff)
Merge branch 'bugfix/mxaliases' into develop
Diffstat (limited to 'puppet/modules/site_postfix/templates')
-rw-r--r--puppet/modules/site_postfix/templates/custom-aliases.erb11
-rw-r--r--puppet/modules/site_postfix/templates/virtual-aliases.erb22
2 files changed, 22 insertions, 11 deletions
diff --git a/puppet/modules/site_postfix/templates/custom-aliases.erb b/puppet/modules/site_postfix/templates/custom-aliases.erb
deleted file mode 100644
index f261514b..00000000
--- a/puppet/modules/site_postfix/templates/custom-aliases.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# This file is managed by puppet.
-#
-# This is a map of custom, non-standard aliases. The contents of this file
-# are derived from the node property `mx.aliases`.
-#
-
-<%- @aliases.keys.sort.each do |from| -%>
-"<%= from %>": "<%= [@aliases[from]].flatten.join('", "') %>"
-<%- end -%>
-
diff --git a/puppet/modules/site_postfix/templates/virtual-aliases.erb b/puppet/modules/site_postfix/templates/virtual-aliases.erb
new file mode 100644
index 00000000..c474e734
--- /dev/null
+++ b/puppet/modules/site_postfix/templates/virtual-aliases.erb
@@ -0,0 +1,22 @@
+#
+# This file is managed by puppet.
+#
+# This is a map of custom, non-standard aliases. The contents of this file
+# are derived from the node property `mx.aliases`.
+#
+
+#
+# enable these virtual domains:
+#
+<%= @domain %> enabled
+<%- @aliases.keys.map {|addr| addr.split('@')[1] }.compact.sort.uniq.each do |virt_domain| -%>
+<%= virt_domain %> enabled
+<%- end %>
+
+#
+# virtual aliases:
+#
+<%- @aliases.keys.sort.each do |from| -%>
+<%- full_address = from =~ /@/ ? from : from + "@" + @domain -%>
+<%= full_address %> <%= [@aliases[from]].flatten.map{|a| a =~ /@/ ? a : a + "@" + @domain}.join(', ') %>
+<%- end -%>