# rules and missing variable

**URL:** <https://forum.ansible.com/t/rules-and-missing-variable/13159>\
**Category:** Ansible Project\
**Created:** [July 18, 2013, 5:30pm UTC](https://forum.ansible.com/t/rules-and-missing-variable/13159 "2013-07-18T17:30:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Filip\_Slunecko](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@Filip\_Slunecko](https://forum.ansible.com/u/Filip_Slunecko)\
**Post date:** [July 18, 2013, 5:30pm UTC](https://forum.ansible.com/t/rules-and-missing-variable/13159/1 "2013-07-18T17:30:00Z")

</div>

Hi,

2 servers - Master and Slave

Playbook looks like this:

- {role: A, when: srv\_role == “master”}
- {role: B, when: srv\_role == “slave”}

role A:

- name: foo1  
shell: bar1  
register: foobar1

- name: foo2  
shell: bar2  
when: foobar1 == “XXX”

I will get an error from server B:  
fatal: =\> Conditional expression must evaluate to True or False: {% if test\_exists.rc == 0 %} True {% else %} False {% endif %}

I think server B should not be influence by this - in verbose mode I can see that server is skipping steps in that role.

Filip

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 18, 2013, 8:58pm UTC](https://forum.ansible.com/t/rules-and-missing-variable/13159/2 "2013-07-18T20:58:48Z")

</div>

This is a known issue and we have an issue about it.

What happens is the conditional statement is being added at the end of the list, not above, so it’s not short circuiting.

I plan to have a short term fix for this in 1.3.

Thanks!

---

<div class="post-metadata">

**Author:** ![Filip\_Slunecko](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@Filip\_Slunecko](https://forum.ansible.com/u/Filip_Slunecko)\
**Post date:** [July 19, 2013, 9:55am UTC](https://forum.ansible.com/t/rules-and-missing-variable/13159/3 "2013-07-19T09:55:31Z")

</div>

I was able to find a workaround for this.  
I just wasn’t sure if it is known bug.  
Is there a better place where to report bugs?

Thanks

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 19, 2013, 11:35am UTC](https://forum.ansible.com/t/rules-and-missing-variable/13159/4 "2013-07-19T11:35:59Z")

</div>

Tickets go to [github.com/ansible/ansible](http://github.com/ansible/ansible)

I agree github search is frustrating, that’s why we’re pushing to close a lot of tickets in the next couple of weeks 🙂

---

<div class="post-metadata">

**Author:** ![Filip\_Slunecko](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@Filip\_Slunecko](https://forum.ansible.com/u/Filip_Slunecko)\
**Post date:** [July 19, 2013, 11:54am UTC](https://forum.ansible.com/t/rules-and-missing-variable/13159/5 "2013-07-19T11:54:12Z")

</div>

Ohh sorry I did not know that.  
Next time I will search for it first.

Thanks
