EX294 Implement advanced Ansible automation Practice Question
Which three of the following are valid methods to pass variables to an Ansible playbook at runtime? (Choose three.)
⚠ Common exam trap
Candidates often confuse variable injection methods with authentication or environment configuration; candidates often mistake `--ask-vault-pass` or `environment` for runtime variable passing, when they serve entirely different purposes in Ansible's architecture.
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
✓
Using '--extra-vars' command line option.
The `--extra-vars` (or `-e`) command-line option allows you to pass variables directly to an Ansible playbook at runtime. This overrides any previously defined variables and can accept key=value pairs or load from JSON/YAML files, making it the primary method for runtime variable injection.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Using '--extra-vars' command line option.
Why this is correct
Correct: This directly passes variables or file paths.
- ✗
Using '--ask-vault-pass' and storing variables in encrypted files.
Why it's wrong here
Incorrect: This is for vault password, not variable passing.
- ✗
Using 'environment' directive in the playbook.
Why it's wrong here
Incorrect: environment sets environment variables for tasks, not Ansible variables.
- ✓
Using 'vars_prompt' in the playbook.
Why this is correct
Correct: vars_prompt prompts for variable input at runtime.
- ✓
Using '-e @file' to load variables from a JSON file.
Why this is correct
Correct: This loads variables from a file.
Go deeper
Related to this question
About these practice questions
One of 392 original EX294 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.