How can I show progress for a long-running Ansible task?

后端 未结 4 1752
渐次进展
渐次进展 2021-01-30 16:41

I have a some Ansible tasks that perform unfortunately long operations - things like running an synchronization operation with an S3 folder. It\'s not always clear if they\'re

4条回答
  •  灰色年华
    2021-01-30 16:51

    Ansible has since implemented the following:

    ---
    # Requires ansible 1.8+
    - name: 'YUM - async task'
      yum:
        name: docker-io
        state: installed
      async: 1000
      poll: 0
      register: yum_sleeper
    
    - name: 'YUM - check on async task'
      async_status:
        jid: "{{ yum_sleeper.ansible_job_id }}"
      register: job_result
      until: job_result.finished
      retries: 30
    

    For further information, see the official documentation on the topic (make sure you're selecting your version of Ansible).

提交回复
热议问题