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

          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.



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/94f4900e-a57f-4e99-9ca8-9669455e41fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to