Add polling info to docs
This commit is contained in:
parent
d3fe5f617a
commit
0bccec9fb5
6 changed files with 40 additions and 14 deletions
2
ansible
2
ansible
|
@ -1 +1 @@
|
||||||
Subproject commit 209760f8f60ec24e3ccb176914965cd1e223abe4
|
Subproject commit 328f58479dc2d0ed5d22cbfeaac060c59eb901dc
|
|
@ -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>
|
<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
|
<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
|
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
|
hosts, so you won’t lose track. If you kick hosts and don’t want
|
||||||
command line.:</p>
|
to poll, it looks like this:</p>
|
||||||
<div class="highlight-python"><pre>ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"
|
<div class="highlight-python"><pre>ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"</pre>
|
||||||
ansible all -n job_status -a jid=123456789</pre>
|
|
||||||
</div>
|
</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
|
<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
|
backgrounded. Typically you’ll be backgrounding shell commands or
|
||||||
software upgrades only.</p>
|
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
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-playbook</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-playbook" lang="en"><a id="id416216"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — run an ansible playbook</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible-playbook <filename.yml> … [options]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible playbooks</strong></span> are a configuration and multinode deployment system. Ansible-playbook is the tool
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-playbook</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-playbook" lang="en"><a id="id508410"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — run an ansible playbook</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible-playbook <filename.yml> … [options]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible playbooks</strong></span> are a configuration and multinode deployment system. Ansible-playbook is the tool
|
||||||
used to run them. See the project home page (link below) for more information.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
used to run them. See the project home page (link below) for more information.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
||||||
<span class="strong"><strong>filename.yml</strong></span>
|
<span class="strong"><strong>filename.yml</strong></span>
|
||||||
</span></dt><dd>
|
</span></dt><dd>
|
||||||
|
@ -22,5 +22,5 @@ Desired level of parallelism. Default 5.
|
||||||
</span></dt><dd>
|
</span></dt><dd>
|
||||||
Prompt for the SSH password instead of assuming key-based authentication with ssh-agent.
|
Prompt for the SSH password instead of assuming key-based authentication with ssh-agent.
|
||||||
</dd></dl></div></div><div class="refsect1" title="ENVIRONMENT"><a id="_environment"></a><h2>ENVIRONMENT</h2><p>The following environment variables may specified.</p><p>ANSIBLE_HOSTS — Override the default ansible hosts file</p><p>ANSIBLE_LIBRARY — Override the default ansible module library path</p></div><div class="refsect1" title="AUTHOR"><a id="_author"></a><h2>AUTHOR</h2><p>Ansible was originally written by Michael DeHaan. See the AUTHORS file
|
</dd></dl></div></div><div class="refsect1" title="ENVIRONMENT"><a id="_environment"></a><h2>ENVIRONMENT</h2><p>The following environment variables may specified.</p><p>ANSIBLE_HOSTS — Override the default ansible hosts file</p><p>ANSIBLE_LIBRARY — Override the default ansible module library path</p></div><div class="refsect1" title="AUTHOR"><a id="_author"></a><h2>AUTHOR</h2><p>Ansible was originally written by Michael DeHaan. See the AUTHORS file
|
||||||
for a complete list of contributors.</p></div><div class="refsect1" title="COPYRIGHT"><a id="_copyright"></a><h2>COPYRIGHT</h2><p>Copyright © 2012, Michael DeHaan</p><p>Ansible is released under the terms of the GPLv3 License.</p></div><div class="refsect1" title="SEE ALSO"><a id="_see_also"></a><h2>SEE ALSO</h2><p>Extensive documentation as well as IRC and mailing list info
|
for a complete list of contributors.</p></div><div class="refsect1" title="COPYRIGHT"><a id="_copyright"></a><h2>COPYRIGHT</h2><p>Copyright © 2012, Michael DeHaan</p><p>Ansible is released under the terms of the GPLv3 License.</p></div><div class="refsect1" title="SEE ALSO"><a id="_see_also"></a><h2>SEE ALSO</h2><p><span class="strong"><strong>ansible</strong></span>(1)</p><p>Extensive documentation as well as IRC and mailing list info
|
||||||
is available on the ansible home page: <a class="ulink" href="https://ansible.github.com/" target="_top">https://ansible.github.com/</a></p></div></div></body></html>
|
is available on the ansible home page: <a class="ulink" href="https://ansible.github.com/" target="_top">https://ansible.github.com/</a></p></div></div></body></html>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible" lang="en"><a id="id560087"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible — run a command somewhere else</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible <host-pattern> [-f forks] [-m module_name] [-a args]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible</strong></span> is an extra-simple tool/framework/API for doing 'remote things' over
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible" lang="en"><a id="id400991"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible — run a command somewhere else</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible <host-pattern> [-f forks] [-m module_name] [-a args]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible</strong></span> is an extra-simple tool/framework/API for doing 'remote things' over
|
||||||
SSH.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
SSH.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
||||||
<span class="strong"><strong>host-pattern</strong></span>
|
<span class="strong"><strong>host-pattern</strong></span>
|
||||||
</span></dt><dd>
|
</span></dt><dd>
|
||||||
|
@ -47,11 +47,15 @@ Connection timeout to use when trying to talk to hosts, in seconds.
|
||||||
</span></dt><dd>
|
</span></dt><dd>
|
||||||
Runs commands in the background, killing the task after N seconds.
|
Runs commands in the background, killing the task after N seconds.
|
||||||
</dd><dt><span class="term">
|
</dd><dt><span class="term">
|
||||||
|
<span class="strong"><strong>-P</strong></span>, <span class="strong"><strong>--poll</strong></span>
|
||||||
|
</span></dt><dd>
|
||||||
|
Poll a background job every (this many) seconds. Requires -B.
|
||||||
|
</dd><dt><span class="term">
|
||||||
<span class="strong"><strong>-u</strong></span>, <span class="strong"><strong>--remote-user</strong></span>
|
<span class="strong"><strong>-u</strong></span>, <span class="strong"><strong>--remote-user</strong></span>
|
||||||
</span></dt><dd>
|
</span></dt><dd>
|
||||||
Use this remote username instead of root
|
Use this remote username instead of root
|
||||||
</dd></dl></div></div><div class="refsect1" title="INVENTORY"><a id="_inventory"></a><h2>INVENTORY</h2><p>Ansible stores the hosts it can potentially operate on in an inventory
|
</dd></dl></div></div><div class="refsect1" title="INVENTORY"><a id="_inventory"></a><h2>INVENTORY</h2><p>Ansible stores the hosts it can potentially operate on in an inventory
|
||||||
file. The syntax is one host per line. Groups headers are allowed and
|
file. The syntax is one host per line. Groups headers are allowed and
|
||||||
are included on their own line, enclosed in square brackets.</p></div><div class="refsect1" title="FILES"><a id="_files"></a><h2>FILES</h2><p>/etc/ansible/hosts — Default inventory file</p><p>/usr/share/ansible/ — Default module library</p></div><div class="refsect1" title="ENVIRONMENT"><a id="_environment"></a><h2>ENVIRONMENT</h2><p>The following environment variables may specified.</p><p>ANSIBLE_HOSTS — Override the default ansible hosts file</p><p>ANSIBLE_LIBRARY — Override the default ansible module library path</p></div><div class="refsect1" title="AUTHOR"><a id="_author"></a><h2>AUTHOR</h2><p>Ansible was originally written by Michael DeHaan. See the AUTHORS file
|
are included on their own line, enclosed in square brackets.</p></div><div class="refsect1" title="FILES"><a id="_files"></a><h2>FILES</h2><p>/etc/ansible/hosts — Default inventory file</p><p>/usr/share/ansible/ — Default module library</p></div><div class="refsect1" title="ENVIRONMENT"><a id="_environment"></a><h2>ENVIRONMENT</h2><p>The following environment variables may specified.</p><p>ANSIBLE_HOSTS — Override the default ansible hosts file</p><p>ANSIBLE_LIBRARY — Override the default ansible module library path</p></div><div class="refsect1" title="AUTHOR"><a id="_author"></a><h2>AUTHOR</h2><p>Ansible was originally written by Michael DeHaan. See the AUTHORS file
|
||||||
for a complete list of contributors.</p></div><div class="refsect1" title="COPYRIGHT"><a id="_copyright"></a><h2>COPYRIGHT</h2><p>Copyright © 2012, Michael DeHaan</p><p>Ansible is released under the terms of the GPLv3 License.</p></div><div class="refsect1" title="SEE ALSO"><a id="_see_also"></a><h2>SEE ALSO</h2><p>Extensive documentation as well as IRC and mailing list info
|
for a complete list of contributors.</p></div><div class="refsect1" title="COPYRIGHT"><a id="_copyright"></a><h2>COPYRIGHT</h2><p>Copyright © 2012, Michael DeHaan</p><p>Ansible is released under the terms of the GPLv3 License.</p></div><div class="refsect1" title="SEE ALSO"><a id="_see_also"></a><h2>SEE ALSO</h2><p><span class="strong"><strong>ansible-playbook</strong></span>(1)</p><p>Extensive documentation as well as IRC and mailing list info
|
||||||
is available on the ansible home page: <a class="ulink" href="https://ansible.github.com/" target="_top">https://ansible.github.com/</a></p></div></div></body></html>
|
is available on the ansible home page: <a class="ulink" href="https://ansible.github.com/" target="_top">https://ansible.github.com/</a></p></div></div></body></html>
|
||||||
|
|
|
@ -112,17 +112,30 @@ Time Limited Background Operations
|
||||||
|
|
||||||
Long running operations can be backgrounded, and their status can be
|
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
|
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
|
hosts, so you won't lose track. If you kick hosts and don't want
|
||||||
command line.::
|
to poll, it looks like this::
|
||||||
|
|
||||||
ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"
|
ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"
|
||||||
|
|
||||||
|
If you do decide you want to check on the job status later, you can::
|
||||||
|
|
||||||
ansible all -n job_status -a jid=123456789
|
ansible all -n job_status -a jid=123456789
|
||||||
|
|
||||||
|
Polling is built-in and looks like this::
|
||||||
|
|
||||||
|
ansible all -B 3600 -P 60 -a "/usr/bin/long_running_operation --do-stuff"
|
||||||
|
|
||||||
|
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 `--forks` value if you want to get all of your jobs started
|
||||||
|
very quickly.
|
||||||
|
|
||||||
Any module other than :ref:`copy` or :ref:`template` can be
|
Any module other than :ref:`copy` or :ref:`template` can be
|
||||||
backgrounded. Typically you'll be backgrounding shell commands or
|
backgrounded. Typically you'll be backgrounding shell commands or
|
||||||
software upgrades only.
|
software upgrades only.
|
||||||
|
|
||||||
After the time limit (in seconds) runs out (``-B``), the process on
|
After the time limit (in seconds) runs out (``-B``), the process on
|
||||||
the remote nodes will be killed.
|
the remote nodes will be killed. Forcibly.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue