issue to use variable for retries in the loop

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

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

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

Thanks!

Here is the issue just created: https://github.com/ansible/ansible/issues/5865

Thanks
Jack

Hi,

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

Regards.

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

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