- name: Install packages package: name: - powerdns state: present - name: Install service configuration copy: src: "files/{{ item }}_rc.conf" dest: "/etc/rc.conf.d/{{ item }}" mode: 0644 owner: root group: wheel loop: - pdns - name: Create directories file: name: "{{ item }}" state: directory mode: 0755 owner: pdns group: pdns loop: - /var/lib/powerdns - /var/lib/powerdns/zones/ - name: Copy files copy: src: "files/{{ item.src }}" dest: "{{ item.dest }}" mode: 0644 owner: root group: wheel loop: - src: pdns.conf dest: /usr/local/etc/pdns/ - src: bind.conf dest: /usr/local/etc/pdns/ - name: Initialize DB command: "sudo -u pdns sqlite3 -init /usr/local/share/doc/powerdns/schema.sqlite3.sql /var/lib/powerdns/pdns.sqlite3" args: creates: "/var/lib/powerdns/pdns.sqlite3" - name: Copy files copy: src: "files/{{ item.src }}" dest: "{{ item.dest }}" mode: 0644 owner: pdns group: pdns loop: - src: master.db dest: /var/lib/powerdns/zones/