AWS DevOps Engineer Professional DOP-C01 – Question460

Ansible provides some methods for controlling how or when a task is ran. Which of the following is a valid method for controlling a task with a loop?

A.
– with: <value>
B. – with_items: <value>
C. – only_when: <conditional>
D. – items: <value>

Correct Answer: B

Explanation:

Explanation:
Ansible provides two methods for controlling tasks, loops and conditionals. The “with_items” context will allow the task to loop through a list of items, while the `when’ context will allow a conditional requirement to be met for the task to run. Both can be used at the same time.
Reference:
http://docs.ansible.com/ansible/playbooks_conditionals.html#loops-a…