EX294 Practice Question: Create content collections and execution environments
A system administrator wants to publish a custom Ansible collection to a private Automation Hub. What is the correct command to build the collection before publishing?
⚠ Common exam trap
It's easy for candidates to confuse the `publish` command (which uploads an existing tarball) with the `build` command (which creates the tarball), leading them to select option B instead of D.
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-galaxy collection build
`ansible-galaxy collection build` is the command that compiles the collection directory into a distributable tarball (e.g., `mycollection-1.0.0.tar.gz`), which is the required artifact for publishing to a private Automation Hub. Without this build step, there is no archive to upload.
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-galaxy collection init mycollection
Why it's wrong here
Init scaffolds a new collection skeleton with directories and metadata; it creates source files rather than packaging them. It is tempting as the first step when authoring a collection from scratch, but publishing requires a built artefact, so init alone leaves nothing to upload to Automation Hub.
- ✗
ansible-galaxy collection publish ./mycollection-1.0.0.tar.gz
Why it's wrong here
Publish uploads an already-built tarball to a galaxy or Automation Hub server; it does not create the artefact. It is tempting because it is the final publishing step, but the question asks for the build command, so the tarball must exist first via ansible-galaxy collection build.
- ✗
ansible-galaxy collection install .
Why it's wrong here
Install retrieves a collection from a repository into the local environment; it performs no build step and produces no tarball for upload. It is tempting because it is the common day-to-day galaxy command, but it is the correct choice when consuming, not publishing, a collection.
- ✓
ansible-galaxy collection build
Why this is correct
The ansible-galaxy collection build command packages the collection directory into a tarball artefact containing the galaxy.yml manifest, roles, plugins and modules. This tarball is the required input for ansible-galaxy collection publish, so building must precede uploading to the private Automation Hub.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX294 question from scratch — 392 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.