collection_opnsense icon indicating copy to clipboard operation
collection_opnsense copied to clipboard

Problem: unbound_host - duplicate entries

Open NiceRath opened this issue 1 year ago • 2 comments
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

NiceRath avatar Apr 23 '24 08:04 NiceRath

It did work without issues last year. Maybe some API change with 24.x?

NiceRath avatar Apr 23 '24 08:04 NiceRath

I would guess the changes in 24.1.3 broke it. But the tests seem to be OK.

ansibleguy avatar Apr 24 '24 17:04 ansibleguy

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'?

NiceRath avatar Apr 27 '24 08:04 NiceRath