infoblox-ansible
infoblox-ansible copied to clipboard
nios_host_record error when trying to change ip of host record
From @martinberg on Aug 07, 2020 13:36
SUMMARY
It doesn't seem to be possible to change the ip of a host record with nios_host_record. Ansible returns an error that "The record 'test.example.com' already exists"
ISSUE TYPE
- Bug Report
COMPONENT NAME
nios_host_record
ANSIBLE VERSION
ansible 2.9.11
config file = /home/user/temp/ansible/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.local/lib/python3.6/site-packages/ansible
executable location = /home/user/.local/bin/ansible
python version = 3.6.8 (default, Jun 11 2019, 15:15:01) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
DEFAULT_HOST_LIST(/home/user/temp/ansible/ansible.cfg) = ['/home/user/temp/ansible/hosts']
HOST_KEY_CHECKING(/home/user/temp/ansible/ansible.cfg) = False
OS / ENVIRONMENT
localhost: RHEL 7.7 Infoblox: 8.2.4
STEPS TO REPRODUCE
There is an existing host record in the "EXTERN" DNS view called 'testdomain.x.com' with IP-adress '1.1.1.99'
- name: DNS change host ip
hosts: localhost
connection: local
vars:
nios_provider:
host: infoblox-host
username: user
password: passwd
dns_revert_list:
- {hostname: "testdomain.x.com", ip: "1.1.1.100", dnsview: "EXTERN"}
tasks:
- name: Change host record IP
nios_host_record:
name: "{{ item.hostname }}"
ipv4:
- address: "{{ item.ip }}"
view: "{{ item.dnsview }}"
state: present
provider: "{{ nios_provider }}"
with_items: "{{ dns_revert_list }}"
tags:
- site2ip
EXPECTED RESULTS
IP of host record to be changed
ACTUAL RESULTS
Error saying the record already exists. No change was made in the Infoblox environment.
failed: [localhost] (item={'hostname': 'testdomain.x.com', 'ip': '1.1.1.100', 'dnsview': 'EXTERN'}) => {"ansible_loop_var": "item", "changed": false, "code": "Client.Ibap.Data.Conflict", "item": {"dnsview": "EXTERN", "hostname": "testdomain.x.com", "ip": "1.1.1.100"}, "msg": "The record 'testdomain.x.com' already exists.", "operation": "create_object", "type": "AdmConDataError"}
Copied from original issue: ansible/ansible#748