When writing playbooks, you may want to perform different actions depending on what kind of machine you're running against. Ansible provides
facts about a machine that you can use to filter down to the actions you need.
These facts are unique to each machine, so sometimes it's difficult to know what's available. If you're wondering about a machine, you can always use the
ansible command line tool to view them all. The ones that you're interested in will usually be prefixed with
To view all available facts:
ansible all -i /path/to/inventory -m setup
If you're only only interested in a certain section (e.g. which programming languages are installed on a machine) you can provide one of the keys from the result as an argument:
ansible all -i /path/to/inventory -m setup -a "filter=ohai_languages"