--- - name: install unbound for Debian OS family apt: pkg=unbound state={{ unbound_pkg_state }} when: ansible_os_family == 'Debian' and unbound_only_zones == false tags: ["packages","unbound"] - name: install unbound for RedHat OS family yum: name=unbound state={{ unbound_pkg_state }} when: ansible_os_family == 'RedHat' and unbound_only_zones == false tags: ["packages","unbound"] - name: Ensure zones folder exist file: path=/etc/unbound/conf.d state=directory mode=755 notify: restart unbound tags: ["configuration","unbound"] - name: Ensure log file exist file: path={{unbound_logfile}} state=touch mode=755 owner=unbound notify: restart unbound tags: ["configuration","unbound"] - name: configure add independant config file template: src={{item}}.j2 dest="/etc/unbound/conf.d/{{item}}" with_items: - 01general.conf - 99forward_zone.conf notify: restart unbound when: unbound_only_zones == false tags: ["configuration","unbound"] - name: configure unbound zones template: src=10zone.conf.j2 dest="/etc/unbound/conf.d/10{{item.name}}.conf" with_items: unbound_zones notify: restart unbound tags: ["configuration","unbound"] - name: retreive unbound conf file list shell: /bin/ls /etc/unbound/conf.d/ register: unbound_conf_list always_run: true tags: ["configuration","unbound"] - name: configure unbound.conf to include all configuration template: src=unbound.conf.j2 dest=/etc/unbound/unbound.conf validate="/usr/sbin/unbound-checkconf %s" notify: restart unbound tags: ["configuration","unbound"] - name: ensure unbound is started/stopped service: name=unbound state={{ unbound_service_state }} enabled={{ unbound_service_enabled }} pattern="unbound" tags: ["service","unbound"]