add ability to set network connection port for a remote relayhost

Signed-off-by: Joshua Colson <joshua.colson@gmail.com>
This commit is contained in:
Joshua Colson
2018-05-23 08:08:23 -07:00
parent 07a56800da
commit 42b4078369
3 changed files with 6 additions and 1 deletions

View File

@@ -24,6 +24,9 @@ end
query = "role:#{node['postfix']['relayhost_role']}"
relayhost = ''
# if the relayhost_port attribute is not port 25, append to the relayhost
relayhost_port = node['postfix']['relayhost_port'].to_s != '25' ? ":#{node['postfix']['relayhost_port']}" : ''
# results = []
if node.run_list.roles.include?(node['postfix']['relayhost_role'])
@@ -36,6 +39,6 @@ else
relayhost = results.map { |n| n['ipaddress'] }.first
end
node.normal['postfix']['main']['relayhost'] = "[#{relayhost}]"
node.normal['postfix']['main']['relayhost'] = "[#{relayhost}]#{relayhost_port}"
include_recipe 'postfix'