Docs rebuild

pull/1256/head
Michael DeHaan 13 years ago
parent 7a4df9e2fc
commit fe2d1c7cc9

@ -84,13 +84,21 @@ key in ``authorized_keys``::
aserver.example.org
bserver.example.org
Now try this:
Set up SSH agent to avoid retyping passwords::
ssh-agent bash
ssh-add ~/.ssh/id_rsa
Now ping all your nodes::
ansible all -m ping
Now run a live command on all of your nodes::
ansible all /bin/echo hello
Congratulations. You've just contacted your nodes with Ansible. It's now time to read some
of the more real-world examples, and explore what you can do with different modules, as well
as the Ansible playbooks language.
as the Ansible playbooks language. Ansible is not just about running commands, but you already
have a working infrastructure!

@ -54,7 +54,7 @@ Vars section
````````````
A list of variables and values that can be used in the plays. These can be used in templates
or 'action' lines and are dereferenced using ```jinja2``` syntax like this:
or 'action' lines and are dereferenced using ```jinja2``` syntax like this::
{{ varname }}
@ -62,12 +62,12 @@ Further, if there are discovered variables about the system (say, if facter or o
installed) these variables bubble up back into the playbook, and can be used on each
system just like explicitly set variables. Facter variables are prefixed with 'facter_'
and Ohai variables are prefixed with 'ohai_'. So for instance, if I wanted to write the
hostname into the /etc/motd file, I could say:
hostname into the /etc/motd file, I could say::
- name: write the motd
- action: template src=/srv/templates/motd.j2 dest=/etc/motd
And in /srv/templates/motd.j2:::
And in /srv/templates/motd.j2::
You are logged into {{ facter_hostname }}
@ -96,7 +96,7 @@ command line. See the module documentation for more info.
Variables, as mentioned above, can be used in action lines. So if, hypothetically, you wanted
to make a directory on each system named after the hostname ... yeah, that's I know silly ... you could
do it like so:
do it like so::
- name: make a directory
- action: mkdir /tmp/{{ facter_hostname }}
@ -125,12 +125,12 @@ Includes
Not all tasks have to be listed directly in the main file. An include file can contain
a list of tasks (in YAML) as well, optionally passing extra variables into the file.
Variables passed in can be deferenced like this (assume a variable named 'user')
Variables passed in can be deferenced like this (assume a variable named 'user')::
{{ user }}
For instance, if deploying multiple wordpress instances, I could contain all of my tasks
in a wordpress.yml file, and use it like so:
in a wordpress.yml file, and use it like so::
- tasks:
- include: wordpress.yml user=timmy

@ -126,14 +126,20 @@ key in <tt class="docutils literal"><span class="pre">authorized_keys</span></tt
aserver.example.org
bserver.example.org</pre>
</div>
<p>Now try this:</p>
<blockquote>
<div>ssh-agent bash
ssh-add ~/.ssh/id_rsa
ansible all -m ping</div></blockquote>
<p>Set up SSH agent to avoid retyping passwords:</p>
<div class="highlight-python"><pre>ssh-agent bash
ssh-add ~/.ssh/id_rsa</pre>
</div>
<p>Now ping all your nodes:</p>
<div class="highlight-python"><pre>ansible all -m ping</pre>
</div>
<p>Now run a live command on all of your nodes:</p>
<div class="highlight-python"><pre>ansible all /bin/echo hello</pre>
</div>
<p>Congratulations. You&#8217;ve just contacted your nodes with Ansible. It&#8217;s now time to read some
of the more real-world examples, and explore what you can do with different modules, as well
as the Ansible playbooks language.</p>
as the Ansible playbooks language. Ansible is not just about running commands, but you already
have a working infrastructure!</p>
</div>
</div>

@ -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-modules</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-modules" lang="en"><a id="id455333"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-modules — stock modules shipped with ansible</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with a number of modules that can be executed directly on remote hosts or through
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</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-modules" lang="en"><a id="id481479"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-modules — stock modules shipped with ansible</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with a number of modules that can be executed directly on remote hosts or through
ansible playbooks.</p></div><div class="refsect1" title="IDEMPOTENCE"><a id="_idempotence"></a><h2>IDEMPOTENCE</h2><p>Most modules other than command are idempotent, meaning they will seek to avoid changes
unless a change needs to be made. When using ansible playbooks, these modules can
trigger change events, as described in <span class="strong"><strong>ansible-playbooks</strong></span>(5).</p><p>Unless otherwise noted, all modules support change hooks.</p></div><div class="refsect1" title="command"><a id="_command"></a><h2>command</h2><p>The command module takes the command name followed by a list of arguments, space delimited.

@ -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-modules</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-modules" lang="en"><a id="id498990"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — format and function of an ansible playbook file</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with <span class="emphasis"><em>ansible-playbook</em></span>, a tool for running playbooks.
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</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-modules" lang="en"><a id="id350237"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — format and function of an ansible playbook file</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with <span class="emphasis"><em>ansible-playbook</em></span>, a tool for running playbooks.
Playbooks can represent frequent tasks, desired system configurations,
or deployment processes.</p></div><div class="refsect1" title="FORMAT"><a id="_format"></a><h2>FORMAT</h2><p>Playbooks are written in YAML.</p></div><div class="refsect1" title="EXAMPLE"><a id="_example"></a><h2>EXAMPLE</h2><p>See:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a class="ulink" href="https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml" target="_top">https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml</a>

@ -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="id501275"></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="id561794"></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>

@ -98,20 +98,17 @@ described in the &#8216;patterns&#8217; documentation. This is just like the fi
<h2>Vars section<a class="headerlink" href="#vars-section" title="Permalink to this headline"></a></h2>
<p>A list of variables and values that can be used in the plays. These can be used in templates
or &#8216;action&#8217; lines and are dereferenced using <tt class="docutils literal"><span class="pre">`jinja2`</span></tt> syntax like this:</p>
<blockquote>
<div>{{ varname }}</div></blockquote>
<div class="highlight-python"><pre>{{ varname }}</pre>
</div>
<p>Further, if there are discovered variables about the system (say, if facter or ohai were
installed) these variables bubble up back into the playbook, and can be used on each
system just like explicitly set variables. Facter variables are prefixed with &#8216;<a href="#id1"><span class="problematic" id="id2">facter_</span></a>&#8216;
and Ohai variables are prefixed with &#8216;<a href="#id3"><span class="problematic" id="id4">ohai_</span></a>&#8216;. So for instance, if I wanted to write the
hostname into the /etc/motd file, I could say:</p>
<blockquote>
<div><ul class="simple">
<li>name: write the motd</li>
<li>action: template src=/srv/templates/motd.j2 dest=/etc/motd</li>
</ul>
</div></blockquote>
<p>And in /srv/templates/motd.j2::</p>
<div class="highlight-python"><pre>- name: write the motd
- action: template src=/srv/templates/motd.j2 dest=/etc/motd</pre>
</div>
<p>And in /srv/templates/motd.j2:</p>
<div class="highlight-python"><pre>You are logged into {{ facter_hostname }}</pre>
</div>
<p>But we&#8217;re getting ahead of ourselves. Let&#8217;s talk about tasks.</p>
@ -134,12 +131,9 @@ command line. See the module documentation for more info.</p>
<p>Variables, as mentioned above, can be used in action lines. So if, hypothetically, you wanted
to make a directory on each system named after the hostname ... yeah, that&#8217;s I know silly ... you could
do it like so:</p>
<blockquote>
<div><ul class="simple">
<li>name: make a directory</li>
<li>action: mkdir /tmp/{{ facter_hostname }}</li>
</ul>
</div></blockquote>
<div class="highlight-python"><pre>- name: make a directory
- action: mkdir /tmp/{{ facter_hostname }}</pre>
</div>
</div>
<div class="section" id="notify-statements">
<h2>Notify statements<a class="headerlink" href="#notify-statements" title="Permalink to this headline"></a></h2>
@ -162,25 +156,16 @@ complete in a particular play.</p>
<h2>Includes<a class="headerlink" href="#includes" title="Permalink to this headline"></a></h2>
<p>Not all tasks have to be listed directly in the main file. An include file can contain
a list of tasks (in YAML) as well, optionally passing extra variables into the file.
Variables passed in can be deferenced like this (assume a variable named &#8216;user&#8217;)</p>
<blockquote>
<div>{{ user }}</div></blockquote>
Variables passed in can be deferenced like this (assume a variable named &#8216;user&#8217;):</p>
<div class="highlight-python"><pre>{{ user }}</pre>
</div>
<p>For instance, if deploying multiple wordpress instances, I could contain all of my tasks
in a wordpress.yml file, and use it like so:</p>
<blockquote>
<div><ul>
<li><dl class="first docutils">
<dt>tasks:</dt>
<dd><ul class="first last simple">
<li>include: wordpress.yml user=timmy</li>
<li>include: wordpress.yml user=alice</li>
<li>include: wordpress.yml user=bob</li>
</ul>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
<div class="highlight-python"><pre>- tasks:
- include: wordpress.yml user=timmy
- include: wordpress.yml user=alice
- include: wordpress.yml user=bob</pre>
</div>
<p>In addition to the explicitly passed in parameters, all variables from the vars section
are also available.</p>
</div>

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save