# Conditional continues to monitor result.  Bug or Feature?

**URL:** <https://forum.ansible.com/t/conditional-continues-to-monitor-result-bug-or-feature/22712>\
**Category:** Ansible Project\
**Created:** [October 3, 2016, 11:37pm UTC](https://forum.ansible.com/t/conditional-continues-to-monitor-result-bug-or-feature/22712 "2016-10-03T23:37:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Schlottman](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Mike\_Schlottman](https://forum.ansible.com/u/Mike_Schlottman)\
**Post date:** [October 3, 2016, 11:37pm UTC](https://forum.ansible.com/t/conditional-continues-to-monitor-result-bug-or-feature/22712/1 "2016-10-03T23:37:36Z")

</div>

I have a playbook that checks to see if ansible can ssh to a VM. If it cannot, it assigns a role of deploy\_vm\_from\_template to the host. During the process of deploying the VM the host gets booted, the network is configured and I verify that ansible can ssh to the host before continuing with other roles.

Everything worked fine, until I decided I needed to restart sssd after verifying that I could ssh to the host. What I found is that once, I could ssh to the host, every task in the role deploy\_vm\_from\_template was skipped. It appears that the “when: result|failed” triggers when “result” is updated in my until loop in the role. I verified this by changing “result” in the playbook to “result\_in\_playbook” and the tasks after the until loop began running instead of being skipped.

My question, is this a bug or a feature? This seems like it could be a very powerful feature. It seems like result is a widely used variable. Should I be using more unique variables to avoid this situation?

# From the playbook

pre\_tasks:

- name: “See if we can ssh to {{ inventory\_hostname }} before attempting to build it”  
local\_action: command ssh -o ConnectTimeout=10 servacct\_ansible@{{ inventory\_hostname }} hostname  
register: result  
ignore\_errors: yes

roles:

- { role: deploy\_vm\_from\_template, when: result|failed }

#From the role

- name: “Wait for {{ inventory\_hostname }} to recognize servacct\_ansible account”  
register: result  
until: result.rc == 0  
retries: 30  
delay: 10

- name: Test ping module  
ping:

---

<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:** [February 10, 2017, 3:58am UTC](https://forum.ansible.com/t/conditional-continues-to-monitor-result-bug-or-feature/22712/2 "2017-02-10T03:58:03Z")

</div>

skipping a task still activates 'register' so subsequent tasks can  
check 'result|skipped' and be conditioned on that fact.
