Reputation: 510
I've the following handler that is invoked correctly, however, all the sequences appear to be run in quick succession. I'd like to run one by one with a specified delay. Will this work?
- name: 'restart process_server_x_instance_y'
shell: '/bin/restarter serverx_instance_{{item}}'
ignore_errors: yes
delay: 5
with_sequence: count={{ number_of_instances|length }}
Is this enough to pause 5 secs after restarting instance_1
,
then 5 secs after instance_2
, etc.?
Upvotes: 2
Views: 4425
Reputation: 68309
Use loop_control
- pause
:
- name: 'restart process_server_x_instance_y'
shell: '/bin/restarter serverx_instance_{{item}}'
ignore_errors: yes
with_sequence: count={{ number_of_instances|length }}
loop_control:
pause: 5
Upvotes: 6