Files
ansible-matzman-test/roles/opnsense/tasks/unbound.yml
T
2026-03-26 08:57:55 +01:00

68 lines
2.9 KiB
YAML

---
- name: Configure Unbound general settings
oxlorg.opnsense.unbound_general:
firewall: "{{ opnsense_firewall }}"
api_key: "{{ opnsense_api_key }}"
api_secret: "{{ opnsense_api_secret }}"
ssl_verify: "{{ opnsense_ssl_verify }}"
api_port: "{{ opnsense_api_port }}"
enabled: "{{ opnsense_unbound_enabled }}"
port: "{{ opnsense_unbound_port }}"
dnssec: "{{ opnsense_unbound_dnssec }}"
register_dhcp_leases: "{{ opnsense_unbound_register_dhcp_leases }}"
register_dhcp_static_mappings: "{{ opnsense_unbound_register_dhcp_static_mappings }}"
register_system_records: "{{ opnsense_unbound_register_system_records }}"
- name: Configure Unbound host overrides
oxlorg.opnsense.unbound_host:
firewall: "{{ opnsense_firewall }}"
api_key: "{{ opnsense_api_key }}"
api_secret: "{{ opnsense_api_secret }}"
ssl_verify: "{{ opnsense_ssl_verify }}"
api_port: "{{ opnsense_api_port }}"
match_fields: "{{ item[1].match_fields | default(['hostname', 'domain', 'record_type']) }}"
hostname: "{{ item[0].hostname }}"
domain: "{{ item[0].domain }}"
record_type: "{{ item[1].type | default('A') }}"
value: "{{ item[1].value }}"
description: "{{ item[0].description | default(omit) }}"
enabled: "{{ item[0].enabled | default(true) }}"
state: "{{ item[1].state | default('present') }}"
loop: "{{ opnsense_unbound_hosts | subelements('records') }}"
- name: Configure Unbound host override aliases
oxlorg.opnsense.unbound_host_alias:
firewall: "{{ opnsense_firewall }}"
api_key: "{{ opnsense_api_key }}"
api_secret: "{{ opnsense_api_secret }}"
ssl_verify: "{{ opnsense_ssl_verify }}"
api_port: "{{ opnsense_api_port }}"
match_fields: "{{ item[1].match_fields | default(['alias', 'domain']) }}"
alias: "{{ item[1].alias | default(item[0].hostname) }}"
domain: "{{ item[1].domain | default(item[0].domain) }}"
target: "{{ item[0].hostname }}.{{ item[0].domain }}"
description: "{{ item[1].description | default(omit) }}"
state: "{{ item[1].state | default('present') }}"
loop: "{{ opnsense_unbound_hosts | subelements('aliases', skip_missing=True) }}"
tags: debug01
- debug:
msg: "{{ opnsense_unbound_hosts | subelements('aliases', skip_missing=True) }}"
tags: debug02
- name: Configure Unbound selective forwards
oxlorg.opnsense.unbound_forward:
firewall: "{{ opnsense_firewall }}"
api_key: "{{ opnsense_api_key }}"
api_secret: "{{ opnsense_api_secret }}"
ssl_verify: "{{ opnsense_ssl_verify }}"
api_port: "{{ opnsense_api_port }}"
domain: "{{ item.domain }}"
target: "{{ item.target }}"
port: "{{ item.port | default(53) }}"
forward_tcp: "{{ item.forward_tcp | default(false) }}"
description: "{{ item.description | default(omit) }}"
enabled: "{{ item.enabled | default(true) }}"
state: "{{ item.state | default('present') }}"
loop: "{{ opnsense_unbound_forwards }}"