Hi All,
I’ve just jumped back on the Ansible train after spending a long time working solely with Docker and noticed a few things I felt were lacking in the Docker module. I’m not the worlds best coder, but I am contemplating a PR to make a few changes to the core docker module or, alternatively, a new ansible-modules-extra addition.
At the moment the current docker module doesn’t seem to make use of all the docker client functionality and, as far as I can tell, is only useful for making sure a container is present/absent/running etc. There doesn’t appear to be a way to perform only one part of the action (e.g. only pull the image, don’t run it). Currently in order to do most tasks I just default back to command
and run docker xxxx yyyyy
from there, as I can usually achieve most things that way. I’d love for it to be close to feature-par with the commandline CLI in terms of what you can/can’t do with the module on remote hosts, so here are my thoughts.
a) Make multiple modules for docker (like there currently is for the aws_* modules, though I understand it’s not quite the same). Something along the lines of:
docker_pull Self Explanitory
docker_push “”
docker_run Wraps docker [create/start/stop/kill/delete] ← pretty much what we already have
docker_exec Run ad-hoc commands inside existing containers and return results
docker_image Populate a docker_images
key in system facts
docker_tag Self Explanitory
docker_inspect Return a dict describing the container/image specified
or …
b) Make each of the above separations sub-commands to a single docker
module (e.g. - docker: action=pull target:myimage:latest
). I’m like this one less, but I can see that the docker_image
module has already been deprecated in favour of a single docker
module.
So, what are your thoughts and is this something you see as worthwhile?
Cheers,
David.