我尝试在Ansible shell模块中设置超时,但它不起作用。如果我在终端中执行相同的命令,它就能正常工作。下面是我的代码
- name: Timeout
shell: "timeout 30s {{ execute_path_nityo }}/execute.sh"
发布于 2021-02-06 00:58:53
- name: Simulate long running op (15 sec),wait for up to 30 sec,poll every 5sec
shell: "{{ execute_path_nityo }}/execute.sh"
async: 30
poll: 5
如果您想为剧本中的某个任务设置更长的超时限制,请使用async并将轮询设置为正值。Ansible仍将阻止您的攻略中的下一个任务,等待异步任务完成、失败或超时。但是,只有当任务超过您使用async参数设置的超时限制时,该任务才会超时。
- name: Execute the script
shell: "/tmp/script.sh 60" # Run for 60 seconds
async: 120 # Maximum allowed time in Seconds
poll: 10 # Polling Interval in Seconds
https://stackoverflow.com/questions/66046989
复制相似问题