Add external API fqdn to /etc/hosts for Admin node, bsc#1080608
+{% set internal_fqdn = "api api." + pillar['internal_infra_domain'] -%}
{% set external_fqdn = pillar['api']['server']['external_fqdn'] -%}
### service names ###
# set the apiserver for 127.0.0.1 on all hosts as haproxy is listening on all nodes
# and forwarding connections to the real master
-{% if "kube-master" in salt['grains.get']('roles', []) %}
-127.0.0.1 api api.{{ pillar['internal_infra_domain'] }}{% if not salt['caasp_filters.is_ip'](external_fqdn) %} {{ external_fqdn }}{% endif %}
+{% if "kube-master" in salt['grains.get']('roles', []) and not salt['caasp_filters.is_ip'](external_fqdn) %}
+127.0.0.1 {{ internal_fqdn }} {{ external_fqdn }}
{% elif "admin" in salt['grains.get']('roles', []) %}
-127.0.0.1 api api.{{ pillar['internal_infra_domain'] }} ldap.{{ pillar['internal_infra_domain'] }}
+127.0.0.1 {{ internal_fqdn }} {{ external_fqdn }} ldap.{{ pillar['internal_infra_domain'] }}
{% else %}
-127.0.0.1 api api.{{ pillar['internal_infra_domain'] }}
+127.0.0.1 {{ internal_fqdn }}
{% endif %}
### admin nodes ###
