mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 11:10:21 -07:00
Docs build + attempt to add image to website
This commit is contained in:
parent
2fb25f1fe8
commit
fae963a6d2
20 changed files with 255 additions and 160 deletions
|
@ -172,28 +172,44 @@ ssh-add ~/.ssh/id_rsa.pub
|
|||
ansible atlanta -a "/sbin/reboot" -f 10</pre>
|
||||
</div>
|
||||
<p>The -f 10 specifies the usage of 10 simultaneous processes.</p>
|
||||
<p>Note that other than the command module, ansible modules do not work like simple scripts. They make the remote system look like you state, and run the commands neccessary to get it there. This is commonly refered to
|
||||
as ‘idempotency’.</p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">Note that other than the <a class="reference internal" href="modules.html#command"><em>command</em></a> module, ansible modules do
|
||||
not work like simple scripts. They make the remote system look like
|
||||
you state, and run the commands necessary to get it there. This
|
||||
is commonly referred to as ‘idempotent’.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="file-transfer-templating">
|
||||
<h2>File Transfer & Templating<a class="headerlink" href="#file-transfer-templating" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Ansible can SCP lots of files to multiple machines in parallel, and optionally use them as template sources.</p>
|
||||
<p>Ansible can SCP lots of files to multiple machines in parallel, and
|
||||
optionally use them as template sources.</p>
|
||||
<p>To just transfer a file directly to many different servers:</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta copy -a "/etc/hosts /tmp/hosts"</pre>
|
||||
</div>
|
||||
<p>To use templating, first run the setup module to put the template variables you would like to use on the remote host. Then use the template module to write the files using the templates. Templates are written in Jinja2 format. Playbooks (covered elsewhere in the documentation) will run the setup module for you, making this even simpler.:</p>
|
||||
<p>To use templating, first run the setup module to put the template
|
||||
variables you would like to use on the remote host. Then use the
|
||||
template module to write the files using the templates. Templates are
|
||||
written in Jinja2 format. Playbooks (covered elsewhere in the
|
||||
documentation) will run the setup module for you, making this even
|
||||
simpler.:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m setup -a "favcolor=red ntp_server=192.168.1.1"
|
||||
ansible webservers -m template -a "src=/srv/motd.j2 dest=/etc/motd"
|
||||
ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
|
||||
</div>
|
||||
<p>Need something like the fqdn in a template? If facter or ohai are installed, data from these projects will also be made available to the template engine, using ‘facter’ and ‘ohai’ prefixes for each.</p>
|
||||
<p>Need something like the fqdn in a template? If facter or ohai are
|
||||
installed, data from these projects will also be made available to the
|
||||
template engine, using ‘facter’ and ‘ohai’ prefixes for each.</p>
|
||||
</div>
|
||||
<div class="section" id="deploying-from-source-control">
|
||||
<h2>Deploying From Source Control<a class="headerlink" href="#deploying-from-source-control" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Deploy your webapp straight from git:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m git -a "repo=git://foo dest=/srv/myapp version=HEAD"</pre>
|
||||
</div>
|
||||
<p>Since ansible modules can notify change handlers (see ‘Playbooks’) it is possible to tell ansible to run specific tasks when the code is updated, such as deploying Perl/Python/PHP/Ruby directly from git and then restarting apache.</p>
|
||||
<p>Since ansible modules can notify change handlers (see
|
||||
<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>) it is possible to tell ansible to run specific tasks
|
||||
when the code is updated, such as deploying Perl/Python/PHP/Ruby
|
||||
directly from git and then restarting apache.</p>
|
||||
</div>
|
||||
<div class="section" id="managing-services">
|
||||
<h2>Managing Services<a class="headerlink" href="#managing-services" title="Permalink to this headline">¶</a></h2>
|
||||
|
@ -206,13 +222,18 @@ ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
|
|||
</div>
|
||||
<div class="section" id="time-limited-background-operations">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
<p>Any module other than ‘copy’ or ‘template’ can be backgrounded. Typically you’ll be backgrounding shell
|
||||
commands or software upgrades only.</p>
|
||||
<p>After the time limit (in seconds) runs out (-B), the process on the remote nodes will be killed.</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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -224,7 +245,7 @@ commands or software upgrades only.</p>
|
|||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Mar 09, 2012.<br/>
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue