mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-04 04:12:48 +00:00
Add polling info to docs
This commit is contained in:
@@ -269,16 +269,25 @@ directly from git and then restarting apache.</p>
|
||||
<h2>Time Limited Background Operations<a class="headerlink" href="#time-limited-background-operations" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Long running operations can be backgrounded, and their status can be
|
||||
checked on later. The same job ID is given to the same task on all
|
||||
hosts, so you won’t lose track. Polling support is pending in the
|
||||
command line.:</p>
|
||||
<div class="highlight-python"><pre>ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"
|
||||
ansible all -n job_status -a jid=123456789</pre>
|
||||
hosts, so you won’t lose track. If you kick hosts and don’t want
|
||||
to poll, it looks like this:</p>
|
||||
<div class="highlight-python"><pre>ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"</pre>
|
||||
</div>
|
||||
<p>If you do decide you want to check on the job status later, you can:</p>
|
||||
<div class="highlight-python"><pre>ansible all -n job_status -a jid=123456789</pre>
|
||||
</div>
|
||||
<p>Polling is built-in and looks like this:</p>
|
||||
<div class="highlight-python"><pre>ansible all -B 3600 -P 60 -a "/usr/bin/long_running_operation --do-stuff"</pre>
|
||||
</div>
|
||||
<p>The above example says “run for 60 minutes max (60*60=3600), poll for status every 60 seconds”.
|
||||
Poll mode is smart so all jobs will be started before polling will begin on any machine.
|
||||
Be sure to use a high enough <cite>–forks</cite> value if you want to get all of your jobs started
|
||||
very quickly.</p>
|
||||
<p>Any module other than <a class="reference internal" href="modules.html#copy"><em>copy</em></a> or <a class="reference internal" href="modules.html#template"><em>template</em></a> can be
|
||||
backgrounded. Typically you’ll be backgrounding shell commands or
|
||||
software upgrades only.</p>
|
||||
<p>After the time limit (in seconds) runs out (<tt class="docutils literal"><span class="pre">-B</span></tt>), the process on
|
||||
the remote nodes will be killed.</p>
|
||||
the remote nodes will be killed. Forcibly.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user