You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I love the module, and it has worked very well for me with a couple slight modification for my environment. I wanted to contribute to the project by letting you know what I tweaked, and seeing if this falls in line with what you've done. Hopefully you would like to add these changes to a future release, as it could help others who have a similar need.
I had to add data content support for both a canonical database and generic database in the server.pp file. While you do have support for the main.cf parameters, there is currently no way to populate the files themselves through an automated fashion, which is what I was after.
-->
$canonical_data = [],
$generic_data = [],
.....
And hashed the default files at the end of server.pp.
-->
postfix::dbfile { 'canonical':
content => template('postfix/canonical.erb'),
}
postfix::dbfile { 'generic':
content => template('postfix/generic.erb'),
}
These templates are very simple. They started with the default "help text" version that comes with postfix. At the bottom, I simple set them up to append anything in hash form from the data variable.
-->
<% @generic_data.each do |line| -%>
<%= line %>
<% end -%>
-->
<% @canonical_data.sort.each do |line| -%>
<%= line %>
<% end -%>
So as you can see, it should fall in line with what is already created. This just allows central configuration of the map data, as opposed to manually creating them on each server. In my environment this is required as none of my servers are routeable through to our corporate mail, and DNS is not resolvable. We use maps to mask our sender to a proper address before it hits a relay.
I hope this helps others out!
Thank you for creating this.
The text was updated successfully, but these errors were encountered:
I have recently updated the templates I started to properly hash these variables. I am still a bit new to this, so while my original templates work, they were not written as proper hashes.
In server.pp
...
$canonical_data = {},
$generic_data = {},
...
And in the templates, I replaced the 3 lines from before with this:
-->
<%- generic_data.keys.sort_by { |sk| (sk.to_s.upcase) }.each do |k| -%>
<%- v = generic_data[k] -%>
<%- if v != :undef and v != '' -%>
<%= k %> <%= v %>
<%- end -%>
<%- end -%>
-->
<%- canonical_data.keys.sort_by { |sk| (sk.to_s.upcase) }.each do |k| -%>
<%- v = canonical_data[k] -%>
<%- if v != :undef and v != '' -%>
<%= k %> <%= v %>
<%- end -%>
<%- end -%>
Good morning!
I love the module, and it has worked very well for me with a couple slight modification for my environment. I wanted to contribute to the project by letting you know what I tweaked, and seeing if this falls in line with what you've done. Hopefully you would like to add these changes to a future release, as it could help others who have a similar need.
-->
$canonical_data = [],
$generic_data = [],
.....
And hashed the default files at the end of server.pp.
-->
postfix::dbfile { 'canonical':
content => template('postfix/canonical.erb'),
}
postfix::dbfile { 'generic':
content => template('postfix/generic.erb'),
}
-->
<% @generic_data.each do |line| -%>
<%= line %>
<% end -%>
-->
<% @canonical_data.sort.each do |line| -%>
<%= line %>
<% end -%>
So as you can see, it should fall in line with what is already created. This just allows central configuration of the map data, as opposed to manually creating them on each server. In my environment this is required as none of my servers are routeable through to our corporate mail, and DNS is not resolvable. We use maps to mask our sender to a proper address before it hits a relay.
I hope this helps others out!
Thank you for creating this.
The text was updated successfully, but these errors were encountered: