# ansible 2 - failed\_when as a list

**URL:** <https://forum.ansible.com/t/ansible-2-failed-when-as-a-list/20211>\
**Category:** Ansible Project\
**Created:** [January 14, 2016, 1:04pm UTC](https://forum.ansible.com/t/ansible-2-failed-when-as-a-list/20211 "2016-01-14T13:04:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![profhase85](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@profhase85](https://forum.ansible.com/u/profhase85)\
**Post date:** [January 14, 2016, 1:04pm UTC](https://forum.ansible.com/t/ansible-2-failed-when-as-a-list/20211/1 "2016-01-14T13:04:42Z")

</div>

`

- name: install it  
become: True  
register: command\_result  
shell:  
./my\_install  
chdir=/tmp/setup  
failed\_when:
- “‘already installed’ not in command\_result.stdout”
- “command\_result.rc != 0”

`

fails with the following message:

> The field ‘failed\_when’ is supposed to be a string type, however the incoming data structure is  
> a \<class ‘ansible.parsing.yaml.objects.AnsibleSequence’\>

In ansible 1.8 this playbook worked. Is there a new feature which replaced the list in `failed_when`?

---

<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:** [January 14, 2016, 11:44pm UTC](https://forum.ansible.com/t/ansible-2-failed-when-as-a-list/20211/2 "2016-01-14T23:44:02Z")

</div>

no, this is a bug, failed\_when, like all conditionals should take a  
string or a list of strings

---

<div class="post-metadata">

**Author:** ![profhase85](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@profhase85](https://forum.ansible.com/u/profhase85)\
**Post date:** [January 15, 2016, 10:36am UTC](https://forum.ansible.com/t/ansible-2-failed-when-as-a-list/20211/3 "2016-01-15T10:36:59Z")

</div>

Thanks, I opened an issue for it
