ansible shell nohup 不生效问题

原创
2022/10/08 14:56
阅读数 377

废话不说,直接上解决方案

使用 async 模式,只需要在任务里添加两行代码,如下:

- name

  shell:

    cmd: "xxx"

  async: 120

  poll: 5

即将该任务异步执行,每 5 秒获取一下执行结果,有结果就返回,不会一直阻塞120 秒。

需要注意的是,当 poll > 0时,依然会阻塞下一个 task 运行,具体参看官方文档(Asynchornous actions and polling)。

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部