diff --git a/docs/docsite/rst/playbooks_async.rst b/docs/docsite/rst/playbooks_async.rst index 6b9f62378c..e9284d1c78 100644 --- a/docs/docsite/rst/playbooks_async.rst +++ b/docs/docsite/rst/playbooks_async.rst @@ -33,7 +33,7 @@ poll value is 10 seconds if you do not specify a value for `poll`:: default. Alternatively, if you do not need to wait on the task to complete, you may -"fire and forget" by specifying a poll value of 0:: +run the task asynchronously by specifying a poll value of 0:: --- @@ -48,36 +48,38 @@ Alternatively, if you do not need to wait on the task to complete, you may poll: 0 .. note:: - You shouldn't "fire and forget" with operations that require - exclusive locks, such as yum transactions, if you expect to run other + You shouldn't attempt run a task asynchronously by specifying a poll value of 0:: to with operations that require + exclusive locks (such as yum transactions) if you expect to run other commands later in the playbook against those same resources. .. note:: Using a higher value for ``--forks`` will result in kicking off asynchronous tasks even faster. This also increases the efficiency of polling. -If you would like to perform a variation of the "fire and forget" where you -"fire and forget, check on it later" you can perform a task similar to the +If you would like to perform a task asynchroniusly and check on it later you can perform a task similar to the following:: - --- + --- # Requires ansible 1.8+ - - name: 'YUM - fire and forget task' - yum: name=docker-io state=installed + - name: 'YUM - async task' + yum: + name: docker-io + state: installed async: 1000 poll: 0 register: yum_sleeper - - name: 'YUM - check on fire and forget task' - async_status: jid={{ yum_sleeper.ansible_job_id }} + - name: 'YUM - check on async task' + async_status: + jid: "{{ yum_sleeper.ansible_job_id }}" register: job_result until: job_result.finished retries: 30 .. note:: - If the value of ``async:`` is not high enough, this will cause the + If the value of ``async:`` is not high enough, this will cause the "check on it later" task to fail because the temporary status file that - the ``async_status:`` is looking for will not have been written or no longer exist + the ``async_status:`` is looking for will not have been written or no longer exist If you would like to run multiple asynchronous tasks while limiting the amount of tasks running concurrently, you can do it this way::