COREDNS_VERSION="{{taskserv.version}}"
COREDNS_NAME="{{taskserv.name}}"
COREDNS_FILE="{{taskserv.etc_corefile}}"

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 servers[pos] and ip == "$network_private_ip" and servers[pos].network_private_ip -%}
{{servers[pos].network_private_ip}}
{%- elif servers[pos] and ip == "$network_public_ip" and settings[pos] and settings[pos].ip_addresses.pub -%} 
{{settings[pos].ip_addresses.pub}} 
{%- endif -%}
{%- else -%}
{{item.ns_ip}}
{%- endif -%}
{%- endfor -%}
"
{% if server.main_domain == "$defaults" or server.main_domain == "" %}
MAIN_DOMAIN_NAME={{server.main_domain}}
{%- else %}
MAIN_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 %}