You are writing an Ansible playbook that copies an updated Nginx configuration file to each web server. The configuration change should take effect only if the copy operation actually modifies the file, and in that case the Nginx service must be restarted by a handler named reload-nginx. Which YAML key should you add to the file-copying task so that Ansible calls the handler only when the task reports a change?
The notify key is added inside a task to reference one or more handlers. When the task's result is changed, Ansible queues the referenced handler(s) to run after all tasks in the current play. No notification occurs if the task is skipped or returns "ok" with no change. The listen keyword belongs in the handler itself, register merely stores a task's output, and delegate_to runs a task on another host without affecting handler invocation.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
How does the 'notify' keyword work in an Ansible playbook?
Open an interactive chat with Bash
What is the purpose of the 'listen' keyword in an Ansible handler?
Open an interactive chat with Bash
When should the 'delegate_to' keyword be used in a task?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Automation, Orchestration, and Scripting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .