Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
76814089
Commit
76814089
authored
10 years ago
by
Adam Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add async fire-forget/check functionality
parent
e36a8d46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletions
+23
-1
docsite/rst/playbooks_async.rst
+22
-0
library/internal/async_status
+1
-1
No files found.
docsite/rst/playbooks_async.rst
View file @
76814089
...
...
@@ -56,6 +56,28 @@ Alternatively, if you do not need to wait on the task to complete, you may
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
following::
---
# Requires ansible 1.7+
- name: 'YUM - fire and forget 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 }}
register: job_result
until: job_result.finished
retries: 30
.. note::
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
.. seealso::
...
...
This diff is collapsed.
Click to expand it.
library/internal/async_status
View file @
76814089
...
...
@@ -80,7 +80,7 @@ def main():
except
Exception
,
e
:
if
data
==
''
:
# file not written yet? That means it is running
module
.
exit_json
(
results_file
=
log_path
,
ansible_job_id
=
jid
,
started
=
1
)
module
.
exit_json
(
results_file
=
log_path
,
ansible_job_id
=
jid
,
started
=
1
,
finished
=
0
)
else
:
module
.
fail_json
(
ansible_job_id
=
jid
,
results_file
=
log_path
,
msg
=
"Could not parse job output:
%
s"
%
data
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment