collection_opnsense
collection_opnsense copied to clipboard
Problem: unbound_host - duplicate entries
trafficstars
Modules
unbound_host
Version
1.2.8
Ansible Version
ansible [core 2.16.4]
OPNSense Version
OPNsense 24.1.2_1-amd64
OPNSense-Plugin Version
No response
Issue
The module does not recognize when an override already exists. It re-creates them every time. We have 100+ of them.
Config Ansible
- name: "OPNSENSE | DNS | {{ domain }} | Add hosts override"
ansibleguy.opnsense.unbound_host:
domain: "{{ domain }}"
hostname: "{{ item.key }}"
value: "{{ item.value.ip | default(item.value) }}"
record_type: "{% if 'type' in item.value %}\
{{ item.value.type }}\
{% elif item.value.ip | default(item.value) | ansible.utils.ipv4 %}\
A\
{% else %}\
AAAA\
{% endif %}"
reload: false
debug: true
with_dict: "{{ hosts }}"
Config OPNSense
No response
Debug Output
Contains too much information
Profiling Output
No response
It did work without issues last year. Maybe some API change with 24.x?
Have cleared all of the unbound overrides using the XML backup/edit/restore trick. Seems like the matching on re-runs works just fine now. Even with >150 records.. Not sure what know what caused it. Maybe some manually added records? Or some OPNSense update did modify the existing config in a way that made it 'incompatible'?