Ansible:同时注册作业id和退出代码

Ansible:同时注册作业id和退出代码,ansible,Ansible,我正在ansible中运行一个异步循环 我希望能够在每次迭代中将shell返回代码注册为作业ID(强制),以便稍后轮询async任务 下面是我目前的方法,它只允许我注册async需求所需的所有内容 - name: some_tests.yml -> Run the tests shell: some test command args: chdir: "test" async: 10000 poll: 0 loop: "{{ test

我正在ansible中运行一个异步循环

我希望能够在每次迭代中将
shell
返回代码注册为作业ID(强制),以便稍后轮询
async
任务

下面是我目前的方法,它只允许我注册
async
需求所需的所有内容

  - name: some_tests.yml -> Run the tests
    shell: some test command
    args:
      chdir: "test"
    async: 10000
    poll: 0
    loop: "{{ test_files.stdout_lines }}"
    loop_control:
      loop_var: "item"
    register: async_results


  - name: tests.yml -> Await  test completion
    async_status:
      jid: "{{ async_result_item.ansible_job_id }}"
    loop: "{{ async_results.results }}"
    loop_control:
      loop_var: "async_result_item"
    register: async_poll_results
    until: async_poll_results.finished
    retries: 100
如何访问每个
shell
执行的
rc

不可能“在每次迭代中同时将shell返回代码注册为(强制)作业ID,以便稍后轮询异步任务”。“异步”任务在不等待“shell”完成的情况下离开。您必须处理“shell”脚本中的结果。例如,登录到一个文件

rc代码和其他已注册属性应在异步轮询结果中。

不可能“在每次迭代中同时将shell返回代码注册为(强制)作业ID,以便稍后轮询异步任务”。“异步”任务在不等待“shell”完成的情况下离开。您必须处理“shell”脚本中的结果。例如,登录到一个文件

rc代码和其他注册属性应在异步轮询结果中