Red Hat Certified Specialist in Ansible Automation — Question 7
Examine the following inventory excerpt file named /home/user/ansible/inventory. [dbservers] db1.example.com
Which of the following files does Ansible check for variables related to that inventory? (Choose all that apply.)
Answer options
- A. /home/user/ansible/dbservers
- B. /home/user/ansible/host_vars/db1.example.com
- C. /home/user/ansible/host_vars/db1
- D. /home/user/ansible/group_vars/dbservers
Correct answer: B, D
Explanation
The correct answers are B and D because Ansible uses the host_vars directory to look for variables specific to the host db1.example.com and the group_vars directory for variables related to the dbservers group. Options A and C are incorrect as they do not conform to Ansible's variable file structure for hosts and groups.