Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Fix old YAML style in async docs #31421

Merged
merged 2 commits into from
Nov 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 14 additions & 12 deletions docs/docsite/rst/playbooks_async.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

---

Expand All @@ -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::
Expand Down