You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a design decision; the same is also true for the docker_container module. The modules only compare parameters that have been explicitly specified, and if they find a difference, they update the container if possible, and if it isn't possible, they recreate it, but only with the parameters explicitly specified to the module.
There are disadvantages and advantages to this; the main advantage is that if a docker_swarm_service or docker_container task (re-)creates a service/container, it is exactly as specified.
(If you use the Docker CLI to remove and re-create a service/container, you also need to specify everything you want in the re-creation command.)
Thanks for the response. That makes sense.
My use case is updating a service which is created by some other mechanism, so I don't have its full specification.
I was looking at using docker_swarm_info to populate all the parameters from the current state, but it seemed like that output doesn't map nicely to the parameters in docker_swarm_service.
My solution was to just run the cli command, which is fine, it does exactly what I want.
SUMMARY
When modifying an existing Docker Swarm service, anything that is not explictly set by the module is overriden with the generally empty defaults.
It's not clear to me if this is the expected behaviour, but it is pretty surprising coming from using the Docker cli.
ISSUE TYPE
COMPONENT NAME
docker_swarm_service
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
RHEL 8.8
STEPS TO REPRODUCE
Targets an existing Docker swarm cluster.
https://gist.github.com/benformosa/7bf92e8975dc912326a0a8f789a47c24
EXPECTED RESULTS
Test 1 uri
,Test 2 uri
,Test 3 uri
should all succeedTest 1 swarm_info
,Test 2 swarm_info
,Test 3 swarm_info
should all have the same outputACTUAL RESULTS
The text was updated successfully, but these errors were encountered: