--- - name: include OS-specific variables ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" - name: install packages ansible.builtin.package: name: unbound state: installed when: ansible_os_family != "OpenBSD" - name: create control keys ansible.builtin.command: argv: - unbound-control-setup creates: "{{ unbound_control_key }}" notify: restart unbound - name: copy config ansible.builtin.template: dest: "{{ unbound_conf }}" src: "unbound.conf.{{ inventory_hostname }}.j2" mode: 0644 owner: root group: "{{ ansible_wheel }}" validate: "unbound-checkconf %s" notify: restart unbound - name: enable service ansible.builtin.service: name: unbound state: started enabled: true