diff --git a/site-cookbooks/kosmos-postgresql/libraries/helpers.rb b/site-cookbooks/kosmos-postgresql/libraries/helpers.rb index 775977e..7d3c397 100644 --- a/site-cookbooks/kosmos-postgresql/libraries/helpers.rb +++ b/site-cookbooks/kosmos-postgresql/libraries/helpers.rb @@ -26,7 +26,13 @@ class Chef if node.chef_environment == "development" server_node['network']['interfaces']['eth1']['routes'].first['src'] else - server_node['ipaddress'] + # If the server has a private Zerotier IP, use it + if server_node['knife_zero'] && server_node['knife_zero']['host'] && \ + server_node['knife_zero']['host'].start_with?("10.1.1.") + server_node['knife_zero']['host'] + else + server_node['ipaddress'] + end end end