dns: Transfered master zones from makefile approach to dynamic updates approach
parent
0232319ccd
commit
ae42f963a2
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: reload apparmor profile
|
|
||||||
command: "/usr/sbin/apparmor_parser -r {{ apparmor_profile }}"
|
|
||||||
notify: restart bind9
|
|
@ -1,10 +0,0 @@
|
|||||||
{{ zones_directory }}/* rw,
|
|
||||||
{{ zones_directory }}/*/tmp-* rwk,
|
|
||||||
# Journal files required by Bind to save temporary changes
|
|
||||||
{{ zones_directory }}/*/zone.db.jbk rwk,
|
|
||||||
{{ zones_directory }}/*/zone.db.jnl rwk,
|
|
||||||
{{ zones_directory }}/*/zone.db.jnw rwk,
|
|
||||||
{{ zones_directory }}/*/zone.db.signed rwk,
|
|
||||||
{{ zones_directory }}/*/zone.db.signed.jbk rwk,
|
|
||||||
{{ zones_directory }}/*/zone.db.signed.jnl rwk,
|
|
||||||
{{ zones_directory }}/*/zone.db.signed.jnw rwk,
|
|
@ -1,11 +0,0 @@
|
|||||||
dest:={{ zones_environment_link_name }}
|
|
||||||
db_name:={{ zones_environment_database_name }}
|
|
||||||
|
|
||||||
zone_dirs:=$(wildcard *.*/)
|
|
||||||
zones:=$(zone_dirs:/=)
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: $(addprefix ${dest}/,$(addsuffix /${db_name},${zones}))
|
|
||||||
|
|
||||||
${dest}/%/${db_name}: %/*.db
|
|
||||||
cat $(sort $^) | sed '0,/^ 0$$/s// '"$$(($$(date +%s) / 60))"'/' > "$@";
|
|
@ -1,25 +1,34 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Store dns entries at dns host
|
- name: Store changes in dns entries locally
|
||||||
copy:
|
copy:
|
||||||
content: "{{ entries }}"
|
content: |
|
||||||
dest: "{{ domain_zone_file }}"
|
#jinja2:trim_blocks: False
|
||||||
owner: root
|
zone {{ dns_zone_domain }}.
|
||||||
group: root
|
ttl {{ ttl_default }}
|
||||||
mode: u=rw,g=r,o=
|
{%- if entries_delete %}{% for entry in entries %}{% if entry|mapping %}
|
||||||
register: result_store_entries
|
update delete {{ entry.domain | default('@') | domain_relative_to(domain) }} 0 {{ entry.class | default('IN') }}{% if not entries_delete_all_types %} {{ entry.type }}{% endif %}
|
||||||
delegate_to: "{{ dns_system_domain }}"
|
{%- endif %}{% endfor %}{% endif %}
|
||||||
|
{% for entry in entries %}{% if entry|mapping -%}
|
||||||
- name: Rebuild zone files
|
update add {{ entry.domain | default('@') | domain_relative_to(domain) }} {{ entry.ttl | default(ttl_default) }} {{ entry.class | default('IN') }} {{ entry.type }} {{ entry.data }}
|
||||||
make:
|
{% else -%}
|
||||||
chdir: "{{ global_dns_zones_environment_directory }}"
|
{% if not entry|regex_search('^(update )?(add|del(ete)?) ') %}update add {% endif %}{{ entry }}
|
||||||
when: result_store_entries.changed
|
{% endif %}{% endfor %}
|
||||||
register: result_rebuild_zone
|
send
|
||||||
delegate_to: "{{ dns_system_domain }}"
|
dest: "{{ local_file }}"
|
||||||
|
owner: "{{ global_local_user }}"
|
||||||
|
group: "{{ global_local_user }}"
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
delegate_to: localhost
|
||||||
|
register: entries_changes_file
|
||||||
|
tags:
|
||||||
|
- dns_entries
|
||||||
|
|
||||||
- name: Reload bind9
|
- name: Update dns entries at dns host
|
||||||
systemd:
|
command:
|
||||||
name: "{{ global_bind_service_name }}"
|
cmd: nsupdate -l # local mode
|
||||||
state: reloaded
|
stdin: "{{ lookup('file', local_file) }}\n"
|
||||||
when: result_rebuild_zone.changed
|
|
||||||
delegate_to: "{{ dns_system_domain }}"
|
delegate_to: "{{ dns_system_domain }}"
|
||||||
|
when: entries_changes_file.changed
|
||||||
|
tags:
|
||||||
|
- dns_entries
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
domain_environment_directory: "{{ global_dns_zones_environment_directory }}/{{ dns_zone_domain }}" # Given by dns/master
|
|
@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
domain_environment_directory: "{{ global_dns_zones_environment_directory }}/{{ domain }}" # Fixed for usage in other roles
|
|
Loading…
Reference in New Issue