But it gets more unwieldy if you're using roles. If my app role needs
to have the IPs for the databases I just have to hope that the
playbook that ends up running the tasks in my play have gathered all
the facts from those other systems. It gets even more
action-at-a-distance when your role is a dependency of another role.
My role can't force a fact gathering expedition to the other hosts.
Now you could say that if my role relies on this information I could
check if there are hosts in the group it cares about and then do a
fail if there aren't any, but lack of information doesn't necessarily
mean something is wrong. For instance, I have dev setups using the
same ansible stuff that I use in staging and production. Dev setups
don't need read-only database slaves running on their laptop. But
staging and production do. If gathering facts from all hosts shows
there aren't any db-slave servers, no biggie we just send the reads to
the master. But it's a problem in production if something changes in
some other role that depends on the app server role but doesn't happen
to gather facts from all the servers. Now production is sending all
reads to the master.
This is a very specific case that could probably be worked around in a
very verbose way, but it would all be simpler if my role could gather
facts as a task. Or maybe have some dependency on facts in the
meta/main.yml or something to make it explicit that I want me some
facts :)
>
https://groups.google.com/d/msgid/ansible-project/CAMFyvFhzUM4beAWcPbJvRL0-RdZbyu0KfMjA-5Hs-7vBkfw4pg%40mail.gmail.com.