Closed pmgad closed 3 years ago
The problem is that published_port
can not be specified (and thus will have value None
) in https://github.com/ansible-collections/community.docker/blob/main/plugins/modules/docker_swarm_service.py#L1796.
resolved_by_pr #136
Fix is working perfect, thank you Felix!
SUMMARY
docker_swarm_service publish with both a host port and ingress results in:
The error was: TypeError: '<' not supported between instances of 'NoneType' and 'int'
ISSUE TYPE
COMPONENT NAME
docker_swarm_service module
collections:
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Linux dev 5.4.0-66-generic #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
STEPS TO REPRODUCE
Run the task:
Service is created with the ingress:
And the randomly assigned host ports are good:
Just having this work is great thanks to https://github.com/ansible-collections/community.docker/issues/99 It allows service discovery of container metrics endpoints as described here: https://prometheus.io/docs/guides/dockerswarm/#monitoring-containers
However, on a 2nd run of the task there is a problem.
EXPECTED RESULTS
Service unchanged
ACTUAL RESULTS