diff --git a/lib/ansible/modules/cloud/docker/docker_swarm_service.py b/lib/ansible/modules/cloud/docker/docker_swarm_service.py index 034c7ab365..f3d01f095a 100644 --- a/lib/ansible/modules/cloud/docker/docker_swarm_service.py +++ b/lib/ansible/modules/cloud/docker/docker_swarm_service.py @@ -1069,7 +1069,6 @@ class DockerServiceManager(): else: changed, changes, need_rebuild, force_update = new_service.compare(current_service) if changed: - changed = True if need_rebuild: if not module.check_mode: self.remove_service(module.params['name']) @@ -1077,7 +1076,6 @@ class DockerServiceManager(): new_service) msg = 'Service rebuilt' rebuilt = True - changes = changes else: if not module.check_mode: self.update_service(module.params['name'], @@ -1085,16 +1083,15 @@ class DockerServiceManager(): new_service) msg = 'Service updated' rebuilt = False - changes = changes else: - if force_update and not module.check_mode: - self.update_service(module.params['name'], - current_service, - new_service) + if force_update: + if not module.check_mode: + self.update_service(module.params['name'], + current_service, + new_service) msg = 'Service forcefully updated' rebuilt = False changed = True - changes = changes else: msg = 'Service unchanged' facts = new_service.get_facts()