2 ansible pause ansible-inventory
我正在我的剧本中尝试以下任务。但不执行暂停。我希望在删除每个主机后播放应该暂停 30 秒。
name: delete host from the NagiosXI
shell: curl -k -XDELETE "https://10.000.00.00/nagiosxi/api/v1/config/host?apikey=qdjcwc&pretty=1&host_name={{ item }}&applyconfig=1"
- pause:
seconds: 120
ignore_error: yes
with_items:
- "{{ groups['grp1'] }}"
Run Code Online (Sandbox Code Playgroud)
如果以正确的方式做或向我提出建议,有人可以建议这是否是正确的方式。我也使用了 serial=1 模块,但它仍然无法正常工作。
您可以在循环下使用 pause :
- name: Pause
hosts: all
gather_facts: False
tasks:
- name: delete host from the NagiosXI
shell: curl -k -XDELETE "https://10.000.00.00/nagiosxi/api/v1/config/host?apikey=qdjcwc&pretty=1&host_name={{ item }}&applyconfig=1"
ignore_errors: True
with_items:
- "{{ groups['grp1'] }}"
loop_control:
pause: 120
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6100 次 |
| 最近记录: |