Scenario / Questions
So I just started a new company, and while familiarizing myself with the ansible repository, I was wondering if there’s any way to see the variables that come from group_vars, host_vars and all that together in one place, it’s non-trivial to gather all the facts about a host. For example if I have a hosts file like
[foo:children] bar [bar] baz
and so I have two group_vars files
--- app: kyle
--- env: prod
and then I have a host_vars file baz.yml
--- type: app-server
is there any way to get an out put like the following:
Host: baz app = kyle env = prod type = app-server
I’ve looked into the setup module, but when I run the equivalent of
ansible all -m setup it returns all of the
ansible_* variables but none of my defined variables.
Find below all possible solutions or suggestions for the above questions..
Found an answer, from here.
ansible all -m debug -a "var=hostvars[inventory_hostname]"
Disclaimer: This has been sourced from a third party syndicated feed through internet. We are not responsibility or liability for its dependability, trustworthiness, reliability and data of the text. We reserves the sole right to alter, delete or remove (without notice) the content in its absolute discretion for any reason whatsoever.