Courseiva

Required Files and Directories in Ansible Collection Structure

An Ansible content creator wants to ensure that a collection is properly structured and meets Red Hat's best practices. Which TWO of the following are required files in a valid Ansible collection structure?

Quick Answer

galaxy.yml is correct because it is the one file every Ansible collection must have to be recognized and published at all - it carries the metadata that identifies the collection, including its namespace, name, version, and authors, and both Ansible Galaxy and Automation Hub read it to know what they are distributing. The explanation also points to meta/runtime.yml as the other required file in this two-answer question, and the two work together for different purposes: galaxy.yml is about identity and packaging, while meta/runtime.yml is about compatibility, defining things like the minimum supported Ansible version and how the collection's plugins map into action groups. Neither file is optional filler; the collection build and import tooling will reject a collection that is missing either one. When you are asked about the required structure of an Ansible collection, it helps to separate the files by what job they do: some describe what the collection is, like galaxy.yml, some describe how it behaves at runtime, like meta/runtime.yml, and others, like the plugins or roles directories, hold the actual content. Recognizing which category a file falls into is usually enough to tell whether it is mandatory or just a common convention.

⚠ Common exam trap

Watch out — candidates often confuse optional documentation files (like `plugins/README.md`) or dependency files (like `requirements.yml`) with the strictly required structural files (`galaxy.yml` and `meta/runtime.yml`), leading them to select non-mandatory options.

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

meta/runtime.yml

A is correct because `meta/runtime.yml` is a required file in a valid Ansible collection structure. It defines the collection's runtime dependencies, such as minimum Ansible version and action group mappings, ensuring the collection is compatible with the Ansible runtime environment. B is correct because `galaxy.yml` is the mandatory metadata file that describes the collection's name, version, authors, and other essential information, and it is required for publishing to Ansible Galaxy or Automation Hub.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • meta/runtime.yml

    Why this is correct

    Correct. This file is required to specify Ansible version compatibility and runtime features.

  • galaxy.yml

    Why this is correct

    Correct. This file is required for all Ansible collections.

  • plugins/README.md

    Why it's wrong here

    Incorrect. This is an optional documentation file.

  • requirements.yml

    Why it's wrong here

    Incorrect. This file is optional and used for external role/collection dependencies.

  • roles/requirements.yml

    Why it's wrong here

    Incorrect. This is not a standard file in the collection structure.

About these practice questions

This EX294 question is part of Courseiva's 520-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 →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on EX294

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Which TWO of the following are required in a valid Ansible collection directory structure?

medium
  • A.`tests/` directory
  • B.`galaxy.yml` file
  • C.`docs/` directory
  • D.`plugins/` directory
  • E.`roles/` directory

Why B: The `galaxy.yml` file is mandatory in a valid Ansible collection directory structure because it serves as the metadata file that defines the collection's name, version, author, and dependencies. Without this file, the collection cannot be properly built, published, or installed via `ansible-galaxy`. It is the equivalent of a package manifest for the collection.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This EX294 practice question is part of Courseiva's free Red Hat 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 EX294 exam.