diff --git a/puppet/zulip/lib/puppet/functions/resolver_ip.rb b/puppet/zulip/lib/puppet/functions/resolver_ip.rb index c270234b58..974311f1a7 100644 --- a/puppet/zulip/lib/puppet/functions/resolver_ip.rb +++ b/puppet/zulip/lib/puppet/functions/resolver_ip.rb @@ -6,6 +6,11 @@ Puppet::Functions.create_function(:resolver_ip) do if parsed[:nameserver].empty? raise 'No nameservers found in /etc/resolv.conf! Configure one by setting application_server.nameserver in /etc/zulip/zulip.conf' end - parsed[:nameserver][0] + resolver = parsed[:nameserver][0] + if resolver.include?(':') + '[' + resolver + ']' + else + resolver + end end end diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp index 9a37f5de89..2a9b3a82fb 100644 --- a/puppet/zulip/manifests/app_frontend_base.pp +++ b/puppet/zulip/manifests/app_frontend_base.pp @@ -78,6 +78,9 @@ class zulip::app_frontend_base { # This may fail in the unlikely change that there is no configured # resolver in /etc/resolv.conf, so only call it is unset in zulip.conf $nginx_resolver_ip = resolver_ip() + } elsif (':' in $configured_nginx_resolver) and ! ('.' in $configured_nginx_resolver) and ! ('[' in $configured_nginx_resolver) { + # Assume this is IPv6, which needs square brackets. + $nginx_resolver_ip = "[${configured_nginx_resolver}]" } else { $nginx_resolver_ip = $configured_nginx_resolver }