200-901 · Question #325
Refer to the exhibit. A network engineer must configure new interfaces on a set of devices and is planning to use an Ansible playbook for the task. All devices support SSH and NETCONF protocol, and…
The correct answer is B. host_vars directory. For Ansible automation with unique variables per device, the host_vars directory is where YAML files containing device-specific variables should be stored.
Question
Refer to the exhibit. A network engineer must configure new interfaces on a set of devices and is planning to use an Ansible playbook for the task. All devices support SSH and NETCONF protocol, and the interface variables are unique per device. In which directory are the YAML files including variables hosted to automate the task with the netconf_config module?
Exhibit
Options
- Acurrent working directory
- Bhost_vars directory
- Cgroup_vars directory
- Dhome directory
How the community answered
(55 responses)- B95% (52)
- C4% (2)
- D2% (1)
Why each option
For Ansible automation with unique variables per device, the `host_vars` directory is where YAML files containing device-specific variables should be stored.
The current working directory is not a standard place for Ansible to automatically find host-specific variables.
The `host_vars` directory is specifically designed in Ansible to store variables unique to individual hosts. When variables for devices are distinct and not shared across groups, placing them in YAML files within `host_vars/<hostname>` ensures that each device receives its correct, specific configuration values.
The `group_vars` directory is used for variables that apply to all hosts within a defined group, not for variables unique to individual hosts.
The home directory is a user-specific directory and is not where Ansible expects to find variables for managed hosts.
Concept tested: Ansible variable precedence and host-specific variables
Source: https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#host-and-group-variables
Topics
Community Discussion
No community discussion yet for this question.
