New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker_* modules: stop returning ansible_facts #52518
Conversation
Is the intention to remove returning any facts at all from those modules or you still want to return facts on the object that has been created/modified? |
There is no point of returning facts of something which is not host-specific. So: no facts should be returned. (Regular return values should be used, no ansible_facts.) |
Discussed at public ansible meeting today, logs are here. Motion to do this passed (last item on this meeting). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shipit
@WojciechowskiPiotr @jamescassell @gundalow and all others involved, thanks a lot for your feedback and helping to get this merged! :) |
SUMMARY
Some of the
docker_*
modules returned ansible_facts:docker_container
returns a fact calleddocker_container
;docker_network
returns a fact calleddocker_network
;docker_volume
returns a fact calleddocker_volume
;docker_service
/docker_compose
returns one fact named as the service for each service.While this can be handy when using these modules, it is in general annoying for multiple reasons:
result.ansible_facts.docker_container
when one cannot directly use thedocker_container
fact (for example, when usingdocker_container
to start several containers in a loop);docker_compose
returns facts named according to user input, it can easily happen that random variables are overridden, which is in most cases not what the user expects;I've already created a PR (merged) which also returns the facts as regular return values, so people can start getting rid of the facts in their playbooks (#51192). I don't think this is enough, though. I want to deprecate the returned facts.
I know that in the past, return values of modules have been deprecated; see
The ``win_disk_image`` module has deprecated the return value ``mount_path``, use ``mount_paths[0]`` instead. This will be removed in Ansible 2.11.
in the 2.7 porting guide. I guess this hasn't been done for returned facts so far (they have been renamed in the past, though: the facts returned bydocker_container
have been renamed fromansible_docker_container
todocker_container
for Ansible 2.3 to avoid conflicts with the connection plugin.) Similarly to returned variables, it is not possible to warn the user when they are used, so that return values and returned facts should be deprecated with care. But I think that for the facts returned by these modules, it is really warranted to deprecate them!ISSUE TYPE
COMPONENT NAME
docker_container
docker_network
docker_volume
docker_compose