You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.3 KiB
YAML

---
- name: Store changes in dns entries on the remote
copy:
content: |
#jinja2:trim_blocks: False
zone {{ dns_zone_domain }}.
ttl {{ ttl_default }}
{%- if entries_delete %}{% for entry in entries %}{% if entry|mapping %}
update delete {{ entry.domain | default('@') | domain_relative_to(domain) }} 0 {{ entry.class | default('IN') }}{% if not entries_delete_all_types %} {{ entry.type }}{% endif %}
{%- endif %}{% endfor %}{% endif %}
{% for entry in entries %}{% if entry|mapping -%}
update add {{ entry.domain | default('@') | domain_relative_to(domain) }} {{ entry.ttl | default(ttl_default) }} {{ entry.class | default('IN') }} {{ entry.type }} {{ entry.data }}
{% else -%}
{% if not entry|regex_search('^(update )?(add|del(ete)?) ') %}update add {% endif %}{{ entry }}
{% endif %}{% endfor %}
send
dest: "{{ entries_file }}"
owner: "{{ global_local_user }}"
group: "{{ global_local_user }}"
mode: u=rw,g=r,o=r
delegate_to: "{{ dns_system_domain }}"
register: entries_changes_file
tags:
- dns_entries
- name: Update dns entries at dns host
make:
chdir: "{{ global_dns_changes_directory }}"
target: "{{ entries_file | basename }}~DONE"
delegate_to: "{{ dns_system_domain }}"
tags:
- dns_entries