From cb3c4fd1448d6884da03182d2045355966a8db39 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 2 May 2025 15:57:49 +0200 Subject: [PATCH] Add support for Alpine Linux --- defaults/main.yml | 2 ++ tasks/main.yml | 23 +++++++++++++++++++++++ vars/alpine.yml | 5 +++++ 3 files changed, 30 insertions(+) create mode 100644 vars/alpine.yml diff --git a/defaults/main.yml b/defaults/main.yml index 118c7c3..c9f13cd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,3 +2,5 @@ unbound_cache_forwarder: - 9.9.9.10 +unbound_cache_listen: [] + diff --git a/tasks/main.yml b/tasks/main.yml index 7493fda..85f96b1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,6 +9,23 @@ 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" @@ -21,3 +38,9 @@ notify: Restart unbound +- name: Enable service + service: + name: unbound + enabled: yes + + diff --git a/vars/alpine.yml b/vars/alpine.yml new file mode 100644 index 0000000..21d8f08 --- /dev/null +++ b/vars/alpine.yml @@ -0,0 +1,5 @@ +--- +unbound_cache_packages: + - unbound + - ldns-tools +