diff --git a/handlers/main.yml b/handlers/main.yml index 47da8fb..f5ce2af 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -50,6 +50,41 @@ - config is defined - config.changed | bool +# unbound +- name: reconfig unbound # noqa no-changed-when + ansible.builtin.command: configctl 'template reload OPNsense/Unbound/' + listen: + - reconfig unbound + - update dnsbl + when: + - config is defined + - config.changed | bool + +- name: update dnsbl # noqa no-changed-when + ansible.builtin.command: configctl unbound dnsbl + listen: + - update dnsbl + notify: reconfig unbound + when: + - config is defined + - config.changed | bool + +- name: reload dns # noqa no-changed-when + ansible.builtin.command: configctl dns reload + listen: + - reconfig unbound + when: + - config is defined + - config.changed | bool + +- name: restart unbound # noqa no-changed-when + ansible.builtin.command: configctl unbound restart + listen: + - reconfig unbound + when: + - config is defined + - config.changed | bool + # openvpn - name: configure openvpn instances # noqa no-changed-when ansible.builtin.command: configctl openvpn configure diff --git a/tasks/unboundplus.yml b/tasks/unboundplus.yml index 83632f3..d2b1e27 100644 --- a/tasks/unboundplus.yml +++ b/tasks/unboundplus.yml @@ -11,6 +11,7 @@ value: "{{ item.value }}" pretty_print: true register: _unbound_settings + notify: "{{ (unboundplussection == 'dnsbl') | ternary('update dnsbl', 'reconfig unbound') }}" with_dict: "{{ unboundplussectionsettings }}" when: - unboundplussectionsettings is defined diff --git a/tasks/unboundplusuuid.yml b/tasks/unboundplusuuid.yml index 9dabb5c..e15bf99 100644 --- a/tasks/unboundplusuuid.yml +++ b/tasks/unboundplusuuid.yml @@ -8,6 +8,7 @@ value: "{{ item.value }}" pretty_print: true register: _unbound_settings_uuid + notify: reconfig unbound with_dict: "{{ _uuidvalues }}" diff --git a/test/test.yml b/test/test.yml index 901f319..502bd27 100644 --- a/test/test.yml +++ b/test/test.yml @@ -26,6 +26,12 @@ - name: stop ipsec # TODO: test this action; use community.general.xml and add a tag to the resulting xml debug: msg: fake handler - stop ipsec + - name: reconfig unbound + debug: + msg: fake handler - reconfig unbound + - name: update dnsbl + debug: + msg: fake handler - update dnsbl tasks: - name: include default vars ansible.builtin.include_vars: