{%- if taskserv.name == "resolv" %} 
HOSTNAME="{{server.hostname}}"
{% if server.ip_addresses.pub %}
PUB_IP="{{server.ip_addresses.pub}}"
{% else %}
PUB_IP=""
{% endif %}
{% if server.ip_addresses.priv %}
PRIV_IP="{{server.ip_addresses.priv}}"
{% else %}
PRIV_IP=""
{% endif %}
NAMESERVERS="{%- for item in taskserv.nameservers -%} 
{%- if item.ns_ip is starting_with("$servers") -%}
{% set arr_ns = item.ns_ip | split(pat=".") %}
{% set pos = arr_ns[1] %}
{% set ip = arr_ns[2] %}
{%- if defs.servers[pos] and ip == "$network_private_ip" and defs.servers[pos].network_private_ip -%}
 {{defs.servers[pos].network_private_ip}}
{%- elif defs.servers[pos] and ip == "$network_public_ip" and defs.servers[pos].ip_addresses.pub -%} 
 {{defs.servers[pos].ip_addresses.pub}} 
{%- endif -%}
{%- else %}
{{item.ns_ip}}
{%- endif -%}
{%- endfor -%}
"
{% if server.main_domain == "$defaults" or server.main_domain == "" %}
DOMAIN_NAME={{server.main_domain}}
{%- else %}
DOMAIN_NAME={{server.main_domain}}
{%- endif %}
{% if taskserv.domains_search == "$defaults" %}
DOMAINS_SEARCH={{server.domains_search}}
{%- elif taskserv.domains_search == "$server" %}
DOMAINS_SEARCH={{server.domains_search}}
{%- else %}
DOMAINS_SEARCH={{taskserv.domains_search}}
{%- endif %}
{%- endif %}
