Skip to content

Commit

Permalink
issue #38 - unboundplus handler
Browse files Browse the repository at this point in the history
  • Loading branch information
zerwes committed Sep 11, 2024
1 parent cef6ed2 commit 55f3ce0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
35 changes: 35 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tasks/unboundplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tasks/unboundplusuuid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
value: "{{ item.value }}"
pretty_print: true
register: _unbound_settings_uuid
notify: reconfig unbound
with_dict: "{{ _uuidvalues }}"


Expand Down
6 changes: 6 additions & 0 deletions test/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 55f3ce0

Please sign in to comment.