How do I see all the inventory variables defined for my host?

0 votes

How do I see all the inventory variables defined for my host? This was a question asked to me in an interview and I didn't know the answer. A little help would be helpful. Thank you :)

Jan 30 in Ansible by Junaid
70 views

1 answer to this question.

0 votes

Hey @Junaid, You can see all the inventory variables defined for the host by running the following command:

ansible-inventory --list --yaml

This would not work if you're using a fact cache. In such a case you need to use a play that gathers facts first and then lists the inventory variables.

answered Jan 30 by Mahir

Related Questions In Ansible

0 votes
1 answer

How do I get a list of all Ansible variables?

Ansible by default gathers facts about machines ...READ MORE

answered Jan 30 in Ansible by Mahir
388 views
0 votes
1 answer

How do I make my_dir available for all hosts? - Ansible

Hey @Kiara,  f you want to make my_dir available to ...READ MORE

answered Feb 1 in Ansible by Anisha
44 views
0 votes
1 answer
0 votes
1 answer

How do I execute a shell script and then use the result in ansible

This can work out for you: - name: ...READ MORE

answered Apr 11, 2018 in Ansible by shubham
• 6,890 points
1,682 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
213 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do i get Ansible predefined variables?

There three types of variables variables gathered from ...READ MORE

answered Jan 24 in Ansible by Parth
242 views