# issue to use variable for retries in the loop

**URL:** <https://forum.ansible.com/t/issue-to-use-variable-for-retries-in-the-loop/14477>\
**Category:** Ansible Project\
**Created:** [February 3, 2014, 9:11pm UTC](https://forum.ansible.com/t/issue-to-use-variable-for-retries-in-the-loop/14477 "2014-02-03T21:11:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack1](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@jack1](https://forum.ansible.com/u/jack1)\
**Post date:** [February 3, 2014, 9:11pm UTC](https://forum.ansible.com/t/issue-to-use-variable-for-retries-in-the-loop/14477/1 "2014-02-03T21:11:37Z")

</div>

Hi,

we are trying to use the variable for the value of retries at loop. But always hit an error. We are using ansible version 1.4.3.

Here is the sample test playbook:

- hosts: test-servers  
vars:  
tries: 5  
tasks:
- name: test  
debug: msg=“looping”  
register: output  
until: no  
retries: “{{ tries | int }}”  
delay: 1

Here is the error we got:

TASK: [test] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [test01] =\> Traceback (most recent call last):  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 394, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 485, in \_executor\_internal  
return self.\_executor\_internal\_inner(host, self.module\_name, self.module\_args, inject, port, complex\_args=complex\_args)  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 694, in \_executor\_internal\_inner  
for x in range(1, retries + 1):  
TypeError: cannot concatenate ‘str’ and ‘int’ objects

FATAL: all hosts have already failed – aborting

Does anyone have some idea? Appreciate your help.

Thanks  
Jack

---

<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:** [February 3, 2014, 9:20pm UTC](https://forum.ansible.com/t/issue-to-use-variable-for-retries-in-the-loop/14477/2 "2014-02-03T21:20:54Z")

</div>

This is probably not something the system is templating out, but should.

Please make sure you have filed a [github.com/ansible/ansible](http://github.com/ansible/ansible) ticket with the above info so we can add templating to this call.

Thanks!

---

<div class="post-metadata">

**Author:** ![jack1](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@jack1](https://forum.ansible.com/u/jack1)\
**Post date:** [February 3, 2014, 9:50pm UTC](https://forum.ansible.com/t/issue-to-use-variable-for-retries-in-the-loop/14477/3 "2014-02-03T21:50:55Z")

</div>

Here is the issue just created: [https://github.com/ansible/ansible/issues/5865](https://github.com/ansible/ansible/issues/5865)

Thanks  
Jack

---

<div class="post-metadata">

**Author:** ![Maxime\_Bellier](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@Maxime\_Bellier](https://forum.ansible.com/u/Maxime_Bellier)\
**Post date:** [July 3, 2014, 1:32am UTC](https://forum.ansible.com/t/issue-to-use-variable-for-retries-in-the-loop/14477/4 "2014-07-03T01:32:23Z")

</div>

Hi,

Have you found a workaround to that issue? I would like to do the same…

Regards.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 4, 2014, 12:29pm UTC](https://forum.ansible.com/t/issue-to-use-variable-for-retries-in-the-loop/14477/5 "2014-07-04T12:29:14Z")

</div>

There won’t be one, a fix just needs to be applied.

Currently we are attacking some more bigger fish in the queue.
