--- - vars: zone_config_file: "{{ dns.patch.etc }}/named.conf.{{ zone.domain_name }}" zone_db_file: "{{ dns.patch.primary_zones }}/db.{{ zone.domain_name }}.zone" - name: Updating primary zone db file ansible.builtin.file: src: "file/ns/zone/db.{{ zone.domain_name }}" dest: "{{ zone_db_file }}" - name: "Creating zone {{ domain_name }}" ansible.builtin.template: src: templates/ns/zone/named.conf.primary-zone.j2 dest: "{{ zone_config_file }}" mode: "644" - name: "Including zone configuration to global configuration" ansible.builtin.blockinfile: path: "{{ dns.path.etc }}/named.conf.local" state: present marker: "// {mark} ANSIBLE MANAGED BLOCK FOR {{ domain_name }} ZONE" block: | "include \"{{ zone_config_file }}\""; marker_begin: BEGIN marker_end: END