# confused about | mandatory

**URL:** <https://forum.ansible.com/t/confused-about-mandatory/18600>\
**Category:** Ansible Project\
**Created:** [June 25, 2015, 7:56am UTC](https://forum.ansible.com/t/confused-about-mandatory/18600 "2015-06-25T07:56:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [June 25, 2015, 7:56am UTC](https://forum.ansible.com/t/confused-about-mandatory/18600/1 "2015-06-25T07:56:10Z")

</div>

What is the scope to which |mandatory applies? It seems that debug is not one of them:

`  
vars:  
vi\_tenant: “{{ tenant | mandatory }}”  
vi\_plants: “{{ plants | mandatory }}”

status: |  
Provisioning tenant security:  
env {{env}}  
tenant {{vi\_tenant}}  
plants {{vi\_plants}}

tasks:

- debug: var=status.split(‘\n’)

`

`TASK: [debug var=status.split('\n')] ****************************************** ok: [localhost] => { "var": { "status.split('\\n')": ["Provisioning tenant security:", "env staging", "tenant tenantA", "plants {{ plants | mandatory }}"] } }`

Why doesn’t the |mandatory fail in this case?. On top of that I am using ‘error\_on\_undefined\_vars = True’

But that also seems to have no effect here as well.

---

<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:** [June 26, 2015, 4:10am UTC](https://forum.ansible.com/t/confused-about-mandatory/18600/2 "2015-06-26T04:10:29Z")

</div>

mandatory is only needed if error\_on\_undefined\_vars=False (which was  
the default long ago)

what version of ansible? os? python?

---

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [June 28, 2015, 12:49pm UTC](https://forum.ansible.com/t/confused-about-mandatory/18600/3 "2015-06-28T12:49:40Z")

</div>

os: ubuntu 14.04  
ansible 1.9.2-rc2 (but maybe 1.9.2-rc1)  
python: 2.7.63

---

<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:** [July 2, 2015, 10:14pm UTC](https://forum.ansible.com/t/confused-about-mandatory/18600/4 "2015-07-02T22:14:51Z")

</div>

So I had not used the feature in a while, it seems that it is currently broken:

[https://github.com/ansible/ansible/issues/10136](https://github.com/ansible/ansible/issues/10136)
