# Ansible module “vmware\_dns\_config” incorrectly returns “changed”, even when arguments unchanged.

**URL:** <https://forum.ansible.com/t/ansible-module-vmware-dns-config-incorrectly-returns-changed-even-when-arguments-unchanged/28449>\
**Category:** Ansible Project\
**Created:** [August 28, 2018, 6:12pm UTC](https://forum.ansible.com/t/ansible-module-vmware-dns-config-incorrectly-returns-changed-even-when-arguments-unchanged/28449 "2018-08-28T18:12:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbaril](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@dbaril](https://forum.ansible.com/u/dbaril)\
**Post date:** [August 28, 2018, 6:12pm UTC](https://forum.ansible.com/t/ansible-module-vmware-dns-config-incorrectly-returns-changed-even-when-arguments-unchanged/28449/1 "2018-08-28T18:12:52Z")

</div>

The Ansible module “vmware\_dns\_config” will incorrectly return a “changed” condition, even when the arguments are unchanged.

The vmware\_dns\_config module does run correctly and changes the ESXi DNS settings as needed, but it always reports a “changed” state.

For example:

- name: Configure DNS for ESXi

vmware\_dns\_config:

hostname: ‘{{ inventory\_hostname }}’

username: ‘{{ vcenter\_username }}’

password: ‘{{ vcenter\_password }}’

validate\_certs: no

# We’re not changing the hostname, but it is a required field.

change\_hostname\_to: ‘{{ inventory\_hostname }}’

domainname: [mydomain.org](http://mydomain.org)

dns\_servers:

- 8.8.8.8

- 8.8.4.4

delegate\_to: localhost

If you run the task a second time, Ansible will report a “changed” state.

Ansible version: 2.7.5 (from CentOS 7.x epel repository)

yum package ansible.noarch 2.6.3-1.el7

Linux: CentOS 7.5.1804

A quick review of the vmware\_dns\_config.py source code shows that a simple “!=” inequality operator is being used to compare the existing DNS servers data structure to the DNS servers data structure passed as arguments in the task statement. There is no normalization to a “list” structure, for example.

The source code handling of the dns\_servers list is very different than the handling of the “ntp\_servers” list in the “vmware\_host\_ntp” module as a comparison, and vmware\_host\_ntp correctly reports an unchanged status when running the task for a second time with unchanged arguments.
