How do I see all the inventory vars defined for my host?
Answer Posted / Rajendra Singh
To view all inventory variables defined for a host in Ansible, you can use the 'debug' module to print the hostvars. Here's an example playbook that does this:nn---
{"hosts":"hostname"n , "tasks":"
- name: Print Inventory Variables
debug: var=ansible_facts["{{ inventory_hostname }}"] "n
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are playbooks in ansible?
Describe the working of ansible.
What are the ansible modules? Explain the different types.
What is the use of ansible vaults?
What are ad-hoc commands? Give an example.
What are ansible vaults and why are they used?
How ansible different from the playbook?
What are the different components of ansible?
How to create encrypted files using ansible?
Why is ‘{{ }}’ notation used?
What is the method to check the inventory vars defined for the host?
How can I display all the inventory vars defined for my host?
How do I set the path or any other environment variable for a task?
Can you copy files recursively onto a target host? If yes, how?
What is ansible tower?