Courseiva

EX294 · topic practice

Implement advanced Ansible automation practice questions

This domain covers advanced Ansible automation for EX294: controlling execution flow with serial, vars_prompt, and delegation, plus conditional task evaluation. Questions present realistic playbook scenarios and ask you to diagnose hangs, partial runs, or unexpected task results using core Ansible directives and modules rather than ad hoc workarounds.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
20 questionsDomain: Implement advanced Ansible automation

What the exam tests

What to know about Implement advanced Ansible automation

You must be able to control play execution with serial, delegate tasks to non-inventory hosts, and make playbooks non-interactive for CI. The single most important thing is knowing how Ansible evaluates task results and host failures so you can diagnose partial runs and hangs.

Using serial and max_fail_percentage to control rolling update batches across inventory hosts

Applying delegate_to and run_once to execute tasks on hosts outside the active play target

Handling vars_prompt non-interactively with extra vars or vars_prompt defaults in CI/CD

Writing failed_when and changed_when conditions to override default task result evaluation

Watch out for

Common Implement advanced Ansible automation exam traps

  • ▸Assuming vars_prompt can read from stdin in CI; it blocks because no TTY is attached, so pass variables via -e or defaults instead.
  • ▸Thinking serial: 1 stops after one host when the real cause is a failure, unreachable host, or max_fail_percentage threshold aborting the play.
  • ▸Using delegate_to without also setting run_once or connection details, causing the task to run once per host or fail on the delegated target.

Practice set

Implement advanced Ansible automation questions

20 questions · select your answer, then reveal the explanation

Question 1mediummultiple choice
Read the full Ansible explanation →

An Ansible playbook fails intermittently when deploying web servers. The error message indicates that a required package is not available in the repository. Which approach would best ensure that the required packages are consistently available before the playbook runs?

Question 2easymultiple choice
Read the full Ansible explanation →

A system administrator wants to run a playbook on all hosts in the 'webservers' group, but only if the host is currently online. Which approach should be used?

Question 3mediummultiple choice
Read the full Ansible explanation →

You have an Ansible playbook that uses the 'lineinfile' module to manage the /etc/ssh/sshd_config file. The playbook runs without errors, but after execution, the SSH service becomes unreachable on some hosts. Investigation reveals that the file contains duplicate lines for 'Port 22' and 'PermitRootLogin no'. The playbook uses the following task:

- name: Ensure SSH settings ansible.builtin.lineinfile: path: /etc/ssh/sshd_config regexp: "^{{ item.key }}" line: "{{ item.key }} {{ item.value }}" loop: - { key: 'Port', value: '22' } - { key: 'PermitRootLogin', value: 'no' }

The playbook is run multiple times. What is the most likely cause of the duplicate lines?

Question 4easymultiple choice
Read the full Ansible explanation →

A systems administrator needs to run a playbook that applies configuration changes to a set of servers. They want to ensure that if any task fails on a host, the playbook continues with the next host without aborting the entire play. Which play-level keyword should they use?

Question 5hardmultiple choice
Read the full Ansible explanation →

An Ansible automation engineer is developing a role that manages a microservice. The role needs to include conditional tasks based on whether a variable `microservice_version` is defined. If defined, it should use that version; otherwise, it should default to `latest`. Which of the following is the most efficient and idiomatic way to implement this default value within the role?

Question 6mediummulti select
Read the full Ansible explanation →

Which THREE statements about Ansible roles are correct? (Select exactly 3)

Question 7hardmultiple choice
Read the full Ansible explanation →

Your team is responsible for managing a fleet of 200 RHEL 8 servers using Ansible Tower. You have been asked to implement a secure automation workflow that meets the following requirements:

1. All playbooks must be stored in a private Git repository hosted on an internal GitLab server. 2. Credentials to access the Git repository must be stored securely in Ansible Tower. 3. The automation must run on a schedule every night at 2:00 AM. 4. If a playbook run fails, the team must be notified via email. 5. The playbooks require SSH private keys to connect to the managed hosts; these keys must be stored securely. 6. A development team needs to be able to launch the same job template manually, but they must not be able to modify the job template or view the credentials.

You have created a Machine Credential for SSH and a Source Control Credential for Git. You have also created a Job Template that references the project, inventory, and credentials. What is the correct sequence of steps to satisfy all requirements?

Question 8mediummultiple choice
Read the full Ansible explanation →

An engineer runs the playbook as shown:

```yaml - hosts: all tasks: - block: - name: configure firewall command: /bin/false - name: enable service service: name=httpd enabled=yes - name: start service service: name=httpd state=started

- hosts: all tasks: - name: next task debug: msg="Continuing to next play" ```

What is the expected result?

Network Topology
start-at-task 'configure firewall'stepRefer to the exhibit.PLAY [Production servers] *******************************TASK [Gathering Facts] *********************************************************ok: [prod01]TASK [configure firewall] ******************************************************Perform task? (y/n/c): ychanged: [prod01]TASK [enable service] **********************************************************Perform task? (y/n/c): nTASK [start service] ***********************************************************Perform task? (y/n/c): cPLAY RECAP *********************************************************************prod01ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Question 9hardmulti select
Read the full Ansible explanation →

An Ansible Automation Platform administrator is reviewing a job template that runs a playbook against a large inventory. To improve performance without sacrificing accuracy, which TWO strategies should be implemented? (Choose two.)

Question 10easymultiple choice
Read the full Ansible explanation →

A large enterprise manages its infrastructure with Ansible Automation Platform. The operations team reports that job runs are taking longer than expected, especially for playbooks that include role dependencies. After investigation, they notice that the control node has high CPU and memory usage during job execution. The inventory contains 500 hosts, and the playbooks use several roles that include dynamic includes (include_tasks) based on conditional variables. The team wants to reduce the load on the control node without changing the playbook logic or reducing functionality. Which action should the team take?

Question 11hardmultiple choice
Read the full Ansible explanation →

A playbook uses the 'include_tasks' module to load platform-specific tasks. The playbook fails intermittently with 'Could not find or access file' error on some runs but works on others. Which of the following is the most likely cause?

Question 12mediummultiple choice
Read the full Ansible explanation →

An Ansible role has multiple dependencies defined in meta/main.yml. One of the dependent roles should be executed before the role's own tasks, but only if a certain condition is met. How can this be implemented?

Question 13hardmultiple choice
Read the full Ansible explanation →

A playbook uses 'delegate_to: localhost' for a task that modifies a local file. The playbook runs against multiple servers. The administrator notices that the local file is overwritten by each parallel execution, causing corruption. Which strategy should be used to prevent this?

Question 14hardmultiple choice
Read the full Ansible explanation →

An Ansible playbook uses 'async' and 'poll' to run a long-running task. The task returns a changed status and the playbook continues. However, the remote server reports that the task failed after the playbook finished. What is the most likely reason?

Question 15easymulti select
Read the full Ansible explanation →

An administrator wants to ensure that Ansible facts gathered from a host are consistent across multiple playbook runs. Which two actions can help achieve this? (Choose two.)

Question 16hardmulti select
Read the full Ansible explanation →

An Ansible playbook repeatedly uses the same pattern: check if a service is running, if not start it, and then verify it's running. Which three Ansible features can be used to reduce code duplication? (Choose three.)

Question 17mediummultiple choice
Read the full Ansible explanation →

Refer to the exhibit. Which of the following is the most likely cause of this error?

Exhibit

TASK [Gathering Facts] *********************************************************
fatal: [server1]: FAILED! => {"msg": "Missing sudo password"}
Question 18hardmultiple choice
Read the full Ansible explanation →

Refer to the exhibit. A playbook targeting the 'webservers' group uses '{{ http_port }}'. What will be the value of 'http_port' on 'web2'?

Exhibit

[webservers]
web1 ansible_host=192.168.1.10 http_port=80
web2 ansible_host=192.168.1.11 http_port=8080

[webservers:vars]
http_port=80
Question 19hardmultiple choice
Read the full Ansible explanation →

An Ansible playbook uses the 'constructed' inventory plugin with 'keyed_groups' to create groups based on 'ansible_distribution'. Despite correct configuration, hosts are not assigned to the expected groups. What is the most likely cause?

Question 20easymultiple choice
Read the full Ansible explanation →

An Ansible playbook uses a 'block' to group multiple tasks and includes a 'rescue' section. If a task inside the block fails, what will happen?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Implement advanced Ansible automation sessions

Start a Implement advanced Ansible automation only practice session

Every question in these sessions is drawn from the Implement advanced Ansible automation domain — nothing else.

Related practice questions

Related EX294 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the EX294 exam test about Implement advanced Ansible automation?
You must be able to control play execution with serial, delegate tasks to non-inventory hosts, and make playbooks non-interactive for CI. The single most important thing is knowing how Ansible evaluates task results and host failures so you can diagnose partial runs and hangs.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Implement advanced Ansible automation questions in a focused session?
Yes — the session launcher on this page draws every question from the Implement advanced Ansible automation domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other EX294 topics?
Use the topic links above to move to related areas, or go back to the EX294 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the EX294 exam covers. They are not copied from any real exam or dump site.