rules and missing variable

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

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!

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

Tickets go to 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 :slight_smile:

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

Thanks