Is it possible to access ansible facts from a custom fact!?

50 views
Skip to first unread message

Guy Matz

unread,
Jun 30, 2015, 4:43:21 PM6/30/15
to ansible...@googlegroups.com
Hello!  I'm writing a custom fact and would like to be able to access information already provided by other ansible facts . . .  anyone know if this is possible?

For example, my fact will return a value based on a part of the hostname and whether or not the machine it's running on is virtual, so i would like to be able to access ansible_virtualization_type, or something similar, from within my fact.

Thanks,
Guy

Brian Coca

unread,
Jul 1, 2015, 11:34:36 AM7/1/15
to ansible...@googlegroups.com
facts are only information, i'm guessing you mean you have a custom
fact gathering module, modules themselves do not get facts unless you
pass them explicitly as an option. But they can use the shared
module_utils/facts.py to get the same facts as the setup module
gathers.



--
Brian Coca
Reply all
Reply to author
Forward
0 new messages