# using the results of a task include in a until loop

**URL:** <https://forum.ansible.com/t/using-the-results-of-a-task-include-in-a-until-loop/20807>\
**Category:** Ansible Project\
**Created:** [March 8, 2016, 7:43pm UTC](https://forum.ansible.com/t/using-the-results-of-a-task-include-in-a-until-loop/20807 "2016-03-08T19:43:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![H\_Kim](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@H\_Kim](https://forum.ansible.com/u/H_Kim)\
**Post date:** [March 8, 2016, 7:43pm UTC](https://forum.ansible.com/t/using-the-results-of-a-task-include-in-a-until-loop/20807/1 "2016-03-08T19:43:11Z")

</div>

Is it possible to use a fact that was set in a include task file in the until condition of the loop?  
When I try to run the following- the driver\_status is never set until after this entire task has completed.

```auto
- name: Loop until status returns successful
  include: tasks/check_xxx_status.yml
  until: driver_status == 'RUNNING' 
  retries: 10
  delay: 10

```

Any help appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![alexey.vazhnov](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@alexey.vazhnov](https://forum.ansible.com/u/alexey.vazhnov)\
**Post date:** [March 9, 2016, 10:28am UTC](https://forum.ansible.com/t/using-the-results-of-a-task-include-in-a-until-loop/20807/2 "2016-03-09T10:28:32Z")

</div>

Try to use:

`

- name: Loop until status returns successful  
include: tasks/check\_xxx\_status.yml  
until: driver\_status == ‘RUNNING’  
retries: 10  
delay: 10  
register: driver\_reg

- debug: var=driver\_reg

- name: Next task  
…  
when: driver\_reg.changed  
`
