确保 Ansible 'with_sequence' 循环中的延迟

The*_*HCD 2 ansible

我有正确调用的以下处理程序,但是,所有序列似乎都快速连续运行。我想以指定的延迟一项一项地运行。这行得通吗?

- 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 }}
Run Code Online (Sandbox Code Playgroud)

这是否足以在重新启动后暂停 5 秒instance_1,然后在 5 秒后暂停instance_2,等等?

Kon*_*rov 6

使用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
Run Code Online (Sandbox Code Playgroud)