AWS DevOps Engineer Professional DOP-C01 – Question471

When specifying more than one conditional requirements for a task, what is the proper method?

A.
– when: foo == "hello" and bar == "world"
B. – when: foo == "hello" – when: bar == "world"
C. – when: foo == "hello" && bar == "world"
D. – when: foo is "hello" and bar is "world"

Correct Answer: A

Explanation:

Explanation:
Ansible will allow you to stack conditionals using `and’ and `or’. It requires it to be in the same `when’ statement, comparisons must be `==’ for equals or `!=’ for not equals and the `and/or’ must be written as such, not `&&/||’.
Reference:
http://docs.ansible.com/ansible/playbooks_conditionals.html#the-whe…