Question 1
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.)
/home/user/ansible/dbservers
/home/user/ansible/host_vars/db1.example.com
/home/user/ansible/host_vars/db1
/home/user/ansible/group_vars/dbservers
Correct answer: BD
Explanation:
Ansible will check in /home/user/ansible/host_vars to find files named after hosts defined in the inventory. Ansible will check this file because there is a group defined in the inventory as dbservers. Reference: https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#understanding-variable-precedence
Ansible will check in /home/user/ansible/host_vars to find files named after hosts defined in the inventory. Ansible will check this file because there is a group defined in the inventory as dbservers.
Reference:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#understanding-variable-precedence