47 lines
888 B
YAML
47 lines
888 B
YAML
---
|
|
- name: Include OS dependent variables
|
|
include_vars: "{{ (ansible_os_family|lower).split(' ')[0] }}.yml"
|
|
|
|
|
|
- name: Install packages
|
|
package:
|
|
name: "{{ item }}"
|
|
with_items: "{{ unbound_cache_packages }}"
|
|
|
|
|
|
- name: Add include to config file
|
|
lineinfile:
|
|
dest: /etc/unbound/unbound.conf
|
|
regexp: '^\s*#*\s*include:'
|
|
line: 'include: "/etc/unbound/unbound.conf.d/*.conf"'
|
|
backup: yes
|
|
|
|
|
|
- name: Create unbound.conf.d directory
|
|
file:
|
|
path: /etc/unbound/unbound.conf.d/
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
|
|
- name: Template config files
|
|
template:
|
|
src: "unbound.conf.d/{{ item }}.j2"
|
|
dest: "/etc/unbound/unbound.conf.d/{{ item }}"
|
|
mode: 0644
|
|
backup: yes
|
|
with_items:
|
|
- server.conf
|
|
- forward-zone.conf
|
|
notify: Restart unbound
|
|
|
|
|
|
- name: Enable service
|
|
service:
|
|
name: unbound
|
|
enabled: yes
|
|
|
|
|