首页 > 解决方案 > 如何杀死ansible中的异步进程?

问题描述

我有一个在后台运行的进程,我知道这个进程不会过期/结束,如何在一段时间后停止这个进程

   -  name: put process to background
      delegate_to: "{{groups['xxx'][0]}}"
      connection: ssh
      shell: xxxxx > to_some_file
      async: 1000
      poll: 0
      register: yum_sleeper     
      vars:
        ansible_python_interpreter: /usr/local/bin/python


X 时间后:如何停止此任务或如何捕获它迄今为止捕获的输出?即使将输出重定向到某个文件,它也不会被捕获,因为任务仍在运行

标签: ansibleansible-2.xansible-inventoryansible-template

解决方案


推荐阅读