So this bug just hit my radar:
https://github.com/ansible/ansible/issues/9104
In a nutshell, when you run the command ansible localhost -m docker -a ‘image=foo state=present’ nothing happens and success is returned. The bug reporter expected that the image they specified would have been downloaded from dockerhub.
Reading the documentation and the code for the docker and docker_image modules, I’m not sure if that’s the correct outcome. At some level it seems like docker_image should be dealing with anything that directly targets docker images and the docker module should deal with anything that directly targets docker containers (My understanding of docker is that images are the persistent, on disk implementations of a set of programs that you could potentially run. containers are an actually running image).
So asking to download an image from docker hub as the bug reporter wants seems like it belongs in docker_image.
Doing this, however, would require changes to the docker and docker_image modules, some of which may be backwards incompatible. For instance, the image parameter could be made non-mandatory in the docker module, the name parameter could become mandatory for some combinations of the state parameter. docker_image could change behaviour to search dockerhub by default or, instead, grow new parameters to use dockerhub to retrieve images that are not yet available. The docker module’s state=present might go away as it doesn’t seem that a container being “present” provides anything useful above what state=running already does.
Does this seem like an overall good general strategy for these two modules?
Do the changes seem like worthwhile clarifications to the separation between the two modules or should we leave the old API alone as much as possible and bolt new features on top of the existing modules?
-Toshio