Add shell module to examples page.

This commit is contained in:
Michael DeHaan 2012-03-31 10:50:47 -04:00
parent 15acaec687
commit f535335fe0
5 changed files with 33 additions and 7 deletions

View file

@ -175,10 +175,24 @@ ansible atlanta -a "/sbin/reboot" -f 10</pre>
<p>The -f 10 specifies the usage of 10 simultaneous processes.</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
<p class="last">-m does not always have to be specified to /usr/bin/ansible because &#8216;command&#8217; is the default ansible module</p>
</div>
<p>If we want to execute a module using the shell, we can avoid using absolute paths, and can also include
pipe and redirection operators. Read more about the differences on the <em class="xref std std-ref">modules</em> page. The shell
module looks like this:</p>
<div class="highlight-python"><pre>ansible raleigh -m shell -a "echo \\$TERM"</pre>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">When using ansible to run commands, and in particular the shell module, be careful of shell quoting rules.</p>
</div>
<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 usually 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 &#8216;idempotent&#8217;.</p>
is commonly referred to as &#8216;idempotence&#8217;, and is a core design goal of ansible. However, we also
recognize that running ad-hoc commands is equally imporant, so Ansible easily supports both.</p>
</div>
</div>
<div class="section" id="file-transfer-templating">

View file

@ -1,6 +1,6 @@
<?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">
<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="id420140"></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 &lt;filename.yml&gt; … [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="id442190"></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 &lt;filename.yml&gt; … [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">
<span class="strong"><strong>filename.yml</strong></span>
</span></dt><dd>

View file

@ -1,6 +1,6 @@
<?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">
<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="id569917"></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 &lt;host-pattern&gt; [-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="id409149"></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 &lt;host-pattern&gt; [-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">
<span class="strong"><strong>host-pattern</strong></span>
</span></dt><dd>

View file

@ -19,11 +19,23 @@ Let's use ansible's command line tool to reboot all web servers in Atlanta, 10 a
The -f 10 specifies the usage of 10 simultaneous processes.
.. note::
-m does not always have to be specified to /usr/bin/ansible because 'command' is the default ansible module
Note that other than the :ref:`command` module, ansible modules do
If we want to execute a module using the shell, we can avoid using absolute paths, and can also include
pipe and redirection operators. Read more about the differences on the :ref:`modules` page. The shell
module looks like this::
ansible raleigh -m shell -a "echo \\$TERM"
.. note::
When using ansible to run commands, and in particular the shell module, be careful of shell quoting rules.
.. note::
Note that other than the :ref:`command` module, ansible modules usually 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'.
is commonly referred to as 'idempotence', and is a core design goal of ansible. However, we also
recognize that running ad-hoc commands is equally imporant, so Ansible easily supports both.
File Transfer & Templating
``````````````````````````

File diff suppressed because one or more lines are too long