infobloxopen / infoblox-ansible

Ansible modules for interfacing to Infoblox systems
GNU General Public License v3.0
54 stars 61 forks source link

Setting nios_host_record state: absent doesn't remove the record #206

Open evilhamsterman opened 8 months ago

evilhamsterman commented 8 months ago

Using infoblox.nios_modules 1.5.0

Create a host, (not using nios_next_ip because per #63 which has been open since 2019, it is not idempotent)

- name: Create ansible-test DNS record
  infoblox.nios_modules.nios_host_record:
    name: ansible-tests.example.com
    ipv4addrs:
      - address: 10.100.0.70
    state: present
    provider: "{{ nios_provider }}"

Create works successfully

TASK [Create ansible-test DNS record] **********************************************
ok: [localhost]

Change the state to absent per docs

- name: Delete ansible-test DNS record
  infoblox.nios_modules.nios_host_record:
    name: ansible-tests.example.com
    ipv4addrs:
      - address: 10.100.0.70
    state: absent
    provider: "{{ nios_provider }}"

Task runs and does not indicate a change

TASK [Create ansible-test DNS record] **********************************************
ok: [localhost]

Check Infoblox and the record still exists

c41m4n commented 3 months ago

I see this issue as well on infoblox.nios_modules v1.6.1.

dlehrman commented 2 months ago

I was able to successfully remove the host record after excluding the ipv4 details.

e.g.

- name: Delete ansible-test DNS record
  infoblox.nios_modules.nios_host_record:
    name: ansible-tests.example.com
    state: absent
    provider: "{{ nios_provider }}"
Torie-Coding commented 2 months ago

I was able to successfully remove the host record after excluding the ipv4 details.

e.g.


- name: Delete ansible-test DNS record

  infoblox.nios_modules.nios_host_record:

    name: ansible-tests.example.com

    state: absent

    provider: "{{ nios_provider }}"

How to you delete it? Even if i dont provide any ip details at all the ansible task is "ok".

dlehrman commented 2 months ago

How to you delete it? Even if i dont provide any ip details at all the ansible task is "ok".

If the host record in question was created with DNS disabled (configure_for_dns: false, dns: false, or Enable in DNS unchecked in the GUI), you will need to include configure_for_dns: false in the delete task.

e.g.

- name: Delete ansible-test DNS record
  infoblox.nios_modules.nios_host_record:
    name: ansible-tests.example.com
    configure_for_dns: false
    state: absent
    provider: "{{ nios_provider }}"
Torie-Coding commented 2 months ago

Wow... but thank you that works!