--- - name: Create BIND9 directories ansible.builtin.file: path: "{{ item }}" state: directory mode: '0755' loop: - "{{ dns_data_dir }}" - "{{ dns_data_dir }}/config" - "{{ dns_data_dir }}/zones" - "{{ dns_data_dir }}/cache" - name: Set DNS zone serial from current timestamp ansible.builtin.set_fact: dns_zone_serial: "{{ lookup('pipe', 'date +%Y%m%d%H') | int }}" - name: Deploy named.conf ansible.builtin.template: src: named.conf.j2 dest: "{{ dns_data_dir }}/config/named.conf" mode: '0644' notify: Restart BIND9 - name: Deploy zone file ansible.builtin.template: src: zone.j2 dest: "{{ dns_data_dir }}/zones/{{ base_domain }}.zone" mode: '0644' notify: Restart BIND9 - name: Deploy BIND9 docker-compose ansible.builtin.template: src: docker-compose.yml.j2 dest: "{{ dns_data_dir }}/docker-compose.yml" mode: '0644' notify: Restart BIND9 - name: Start BIND9 community.docker.docker_compose_v2: project_src: "{{ dns_data_dir }}" state: present when: not (molecule_test_mode | default(false)) - name: Wait for BIND9 to be ready ansible.builtin.wait_for: host: 127.0.0.1 port: 53 timeout: 30 when: not (molecule_test_mode | default(false))