I have to do some benchmarks and loop over 10 commands 3 times (run all 10x3, not the firstx3 then the secondx3 - so run all 10x3). The 10 commands I extract from a file in
I believe your best option is to write custom module that will encapsulate all the steps that you trying to achieve. And put all the variables that different from 1 run to another into a single list.
Based on what you describing I can assume you have problems with:
This will be much cleaner to have a line that would look similar to this:
- name: Run my nagios checks
my_custom_nagios_module_1.0: >
date={{ item.date }}
varaible_x={{ item.x }}
with_items:
- { date: '%Y-%m-%d', x: 'foo' }
- { date: '%Y-%m-%d', x: 'bar' }
- { date: '%Y-%m-%d', x: 'baz' }
as opposed to repeat the same set of tasks over and over again.