# Can conditional "OR" operator be syntactically indented similar to the "AND" operator?

**URL:** <https://forum.ansible.com/t/can-conditional-or-operator-be-syntactically-indented-similar-to-the-and-operator/23066>\
**Category:** Ansible Project\
**Created:** [November 21, 2016, 6:20pm UTC](https://forum.ansible.com/t/can-conditional-or-operator-be-syntactically-indented-similar-to-the-and-operator/23066 "2016-11-21T18:20:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![burns498](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@burns498](https://forum.ansible.com/u/burns498)\
**Post date:** [November 21, 2016, 6:20pm UTC](https://forum.ansible.com/t/can-conditional-or-operator-be-syntactically-indented-similar-to-the-and-operator/23066/1 "2016-11-21T18:20:01Z")

</div>

Hello -

Can the conditional “OR” operator be syntactically indented similar to the “AND” operator?

“AND” can be written in either of these ways:  
[Source](http://stackoverflow.com/questions/34867533/ansible-when-condition-not-working-with-logical-and-operator)

> ```auto
> when: django_migration_result|changed and ('Applying auth.0001_initial... OK' in django_migration_result.stdout)
> 
> ```

or

> `when:`  
> `- django_migration_result | changed`
> 
> - ‘Applying auth.0001\_initial… OK’ in django\_migration\_result.stdout

“OR” can be written as:

> failed\_when: expect\_output.stdout | search(“(ORA|SP2)-[0-9]+”) or expect\_output.stdout | search(“Usage”)

but I can’t get the below attempt to work.

> failed\_when:
> 
> - expect\_output.stdout | search(“(ORA|SP2)-[0-9]+”) or
> - expect\_output.stdout | search(“Usage”)

Thoughts?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 22, 2016, 3:13pm UTC](https://forum.ansible.com/t/can-conditional-or-operator-be-syntactically-indented-similar-to-the-and-operator/23066/2 "2016-11-22T15:13:16Z")

</div>

Not that way but you can use YAML multiline

failed\_when: \>  
expect\_output.stdout | search(“(ORA|SP2)-[0-9]+”) or  
expect\_output.stdout | search(“Usage”)

---

<div class="post-metadata">

**Author:** ![burns498](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@burns498](https://forum.ansible.com/u/burns498)\
**Post date:** [November 22, 2016, 5:51pm UTC](https://forum.ansible.com/t/can-conditional-or-operator-be-syntactically-indented-similar-to-the-and-operator/23066/3 "2016-11-22T17:51:33Z")

</div>

Thanks Brian! That YAML multiline notation worked out wonderfully for this. Thanks for educating me!
