- name: install packages for bind9 apt: name: '{{ packages }}' state: present vars: packages: - bind9 - bind9-host - cron - name: create zone directory file: path: /etc/bind/zones owner: bind group: bind mode: 0700 state: directory - name: create log directory file: path: /var/log/named owner: bind group: bind mode: 0700 state: directory - name: copy bind configuration files template: src: '{{ item }}.j2' dest: '/etc/bind/{{ item }}' owner: root group: root mode: 0644 loop: - named.conf - named.conf.options - named.conf.local notify: restart bind - name: create keys directory file: path: /etc/bind/keys owner: root group: bind mode: 0750 state: directory - name: add cron dnssec template: src: dnssec.j2 dest: /etc/cron.weekly/dnssec owner: root group: root mode: 0700 tags: bind