From 637e9942ffcbe3cf35b4b1973c1894551b0c10b5 Mon Sep 17 00:00:00 2001 From: nerzhul Date: Thu, 6 Apr 2017 17:53:06 +0200 Subject: [PATCH] Nsupdate idempotency fix --- lib/ansible/modules/network/nsupdate.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/network/nsupdate.py b/lib/ansible/modules/network/nsupdate.py index 5ba70d536fc..fd756476b49 100644 --- a/lib/ansible/modules/network/nsupdate.py +++ b/lib/ansible/modules/network/nsupdate.py @@ -223,14 +223,15 @@ class RecordManager(object): self.dns_rc = self.modify_record() if self.dns_rc != 0: result['msg'] = "Failed to update DNS record (rc: %d)" % self.dns_rc + + if self.dns_rc != 0: + result['failed'] = True + else: + result['changed'] = True + else: result['changed'] = False - if self.dns_rc != 0: - result['failed'] = True - else: - result['changed'] = True - return result def create_record(self):