summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/cloud/docker/docker_swarm_service.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/modules/cloud/docker/docker_swarm_service.py')
-rw-r--r--lib/ansible/modules/cloud/docker/docker_swarm_service.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/ansible/modules/cloud/docker/docker_swarm_service.py b/lib/ansible/modules/cloud/docker/docker_swarm_service.py
index 359f84972e..d4e83a2df5 100644
--- a/lib/ansible/modules/cloud/docker/docker_swarm_service.py
+++ b/lib/ansible/modules/cloud/docker/docker_swarm_service.py
@@ -1927,8 +1927,11 @@ class DockerService(DockerBaseClass):
def has_healthcheck_changed(self, old_publish):
if self.healthcheck_disabled is False and self.healthcheck is None:
return False
- if self.healthcheck_disabled and old_publish.healthcheck is None:
- return False
+ if self.healthcheck_disabled:
+ if old_publish.healthcheck is None:
+ return False
+ if old_publish.healthcheck.get('test') == ['NONE']:
+ return False
return self.healthcheck != old_publish.healthcheck
def has_publish_changed(self, old_publish):
@@ -2053,6 +2056,8 @@ class DockerService(DockerBaseClass):
container_spec_args['labels'] = self.container_labels
if self.healthcheck is not None:
container_spec_args['healthcheck'] = types.Healthcheck(**self.healthcheck)
+ elif self.healthcheck_disabled:
+ container_spec_args['healthcheck'] = types.Healthcheck(test=['NONE'])
if self.hostname is not None:
container_spec_args['hostname'] = self.hostname
if self.hosts is not None: