mediumMultiple Select
350-401 Practice Question: Which two statements about Ansible inventory…
Which two statements about Ansible inventory files are true? (Choose two.)
⚠ Common exam trap
350-401 often tests inventory basics — candidates wrongly believe only INI format is supported or that group variables must live in separate files, missing YAML support and inline variable definitions.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Ansible can use a dynamic inventory script that queries an external source such as AWS EC2.
Option A is correct because Ansible supports dynamic inventory, where an executable inventory script (or inventory plugin) queries an external source such as AWS EC2 and returns host data in JSON, allowing hosts to be discovered at runtime. Option B is correct because, when no inventory is specified with -i or configured in ansible.cfg, Ansible falls back to the default inventory file located at /etc/ansible/hosts. Option C is false because inventories can be written in INI, YAML, or as dynamic JSON-producing scripts, not INI only. Option D is false because group variables can be defined directly inside the inventory file (e.g., [group:vars] in INI) as well as in group_vars files. Option E is false because inventory hosts may be specified as hostnames, IP addresses, or FQDNs.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Ansible can use a dynamic inventory script that queries an external source such as AWS EC2.
Why this is correct
Dynamic inventory scripts let Ansible query external sources such as AWS EC2 at runtime, so hosts are discovered rather than hard-coded in a static file. This satisfies the requirement to manage cloud instances whose addresses change frequently, keeping the inventory current without manual edits.
- ✓
The default location for the Ansible inventory file is /etc/ansible/hosts.
Why this is correct
Ansible searches /etc/ansible/hosts when no inventory is specified via the -i flag or ansible.cfg, satisfying the default-location constraint in the stem. This static INI file defines managed hosts and groups, so the statement accurately describes Ansible's built-in fallback path rather than a configurable override.
- ✗
Ansible inventory files can only be written in INI format.
Why it's wrong here
Ansible inventory files can be written in INI, YAML, or as dynamic inventory scripts and plugins, so restricting them to INI is false. It is tempting because INI is the traditional default format shown in most introductory documentation, but YAML inventories and dynamic sources are equally valid and commonly used in production.
- ✗
Group variables in an inventory must be defined in separate files under the group_vars directory.
Why it's wrong here
Group variables can be defined directly inside the inventory file under a group's vars section, not only in group_vars files. It is tempting because the group_vars directory is the recommended layout for larger projects, but it is a convention rather than a requirement, and inline definitions remain valid.
- ✗
The inventory file can only contain hostnames, not IP addresses.
Why it's wrong here
Inventory entries accept IP addresses, hostnames, and fully qualified domain names interchangeably, so limiting them to hostnames is false. It is tempting because hostnames are more readable and survive address changes, but inventories routinely list bare IPs for hosts lacking DNS records.
Go deeper
Related to this question
About these practice questions
This 350-401 question is part of Courseiva's 1,923-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
This 350-401 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 350-401 exam.