Home » Amazon » AWS DevOps Engineer Professional v.2 » How can you protect your information?
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/Reference:
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-when-statement