1

I have an Ansible project with more or less 100 hosts (much more in a near future), this project does several calls to an API that as a limit rate of 1000 calls per token.

In my project I define the token on group_vars and what I want is to run a task and have the token changed every 20 hosts, like the first 20 hosts would have the group_var token=A, the next 20 hosts would have the group_var token=B, etc ...

Is there any way to do this ? I took a look on loop docs but it seems that all loops are meant to run multiple variables on each host and that's quite the opposite of what I'm trying to achieve.

Bruce Becker
  • 277
  • 1
  • 4
  • 18
João Pereira
  • 39
  • 3
  • 7
  • 1
    Count, divide counter by 20, take the resulting integer and use it as an index to an array of tokens. – techraf Apr 30 '18 at 09:25

0 Answers0