vmware / ansible-for-nsxt

Ansible delivers simple IT automation that ends repetitive tasks and frees up DevOps teams for more strategic work. This project is to enable this automation for NSX-T installation.
Other
171 stars 140 forks source link

nsxt_ip_pools not idempotent #64

Open simplygeekuk opened 5 years ago

simplygeekuk commented 5 years ago

The nsxt_ip_pools module always updates the resource, even when nothing has been changed. The message "ip pool with pool id a7b7d048-87f5-4848-a585-c2ffe618f9df updated." is displayed on every execution.

changed: [sg1-nsx002] => { "body": "{u'subnets': [{u'cidr': u'10.1.111.0/24', u'dns_nameservers': [], u'allocation_ranges': [{u'start': u'10.1.111.10', u'end': u'10.1.111.20'}]}], u'_system_owned': False, u'display_name': u'SiteA-CMP-VxLAN', u'_create_user': u'admin', u'_revision': 2, u'_protection': u'NOT_PROTECTED', u'_create_time': 1553353847871, u'_last_modified_time': 1553354083398, u'_last_modified_user': u'admin', u'id': u'a7b7d048-87f5-4848-a585-c2ffe618f9df', u'resource_type': u'IpPool'}", "changed": true, "id": "a7b7d048-87f5-4848-a585-c2ffe618f9df", "invocation": { "module_args": { "display_name": "SiteA-CMP-VxLAN", "hostname": "sg1-nsx002.sgroot.local", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 443, "state": "present", "subnets": [ { "allocation_ranges": [ { "end": "10.1.111.20", "start": "10.1.111.10" } ], "cidr": "10.1.111.0/24" } ], "tags": null, "username": "admin", "validate_certs": false } }, "message": "ip pool with pool id a7b7d048-87f5-4848-a585-c2ffe618f9df updated." }

laidbackware commented 5 years ago

This is because the comparison does not take into account bland DNS entries which the API server always return on a get, even if DNS was not configured. A short term workaround is to set DNS servers on the IP pool.