--- - name: install powerdns apt: pkg: - pdns-server - pdns-backend-bind notify: - delete pdns bind.conf - name: delete debian defaults file: path: "{{ item }}" state: absent with_list: - /etc/powerdns/named.conf - /etc/powerdns/pdns.d/bind.conf - name: copy powerdns config template: src: pdns.conf.j2 dest: /etc/powerdns/pdns.conf owner: root group: root mode: 0644 notify: - restart powerdns - name: create folders file: path: "{{ item.path }}" state: directory owner: "{{ item.owner|d('pdns') }}" group: "{{ item.group|d('pdns') }}" mode: "{{ item.mode|d('0755') }}" with_items: - { "path": "/var/lib/powerdns/tpl/" } - { "path": "/var/lib/powerdns/zones/" } - { "path": "/etc/powerdns/pdns.d/" } - { "path": "/etc/powerdns/backends/" } - name: copy powerdns bind backend config template: src: backend-bind.conf.j2 dest: /etc/powerdns/backends/bind.conf owner: root group: root mode: 0644 notify: - restart powerdns - name: create bind zonefile templates template: src: zonefile.db.j2 dest: "/var/lib/powerdns/tpl/{{ item }}" owner: root group: root mode: 0644 with_items: "{{ powerdns.zones.keys()|list }}" register: zonefilestask notify: - copy bind zone file - set bind zone serial - reload changed bind zones - purge cache - notify slaves tags: updatedns