Docs rebuild

This commit is contained in:
Michael DeHaan 2012-03-08 23:06:07 -05:00
parent 7a4df9e2fc
commit fe2d1c7cc9
8 changed files with 49 additions and 50 deletions

View file

@ -84,13 +84,21 @@ key in ``authorized_keys``::
aserver.example.org aserver.example.org
bserver.example.org bserver.example.org
Now try this: Set up SSH agent to avoid retyping passwords::
ssh-agent bash ssh-agent bash
ssh-add ~/.ssh/id_rsa ssh-add ~/.ssh/id_rsa
Now ping all your nodes::
ansible all -m ping 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 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 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!

View file

@ -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 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 }} {{ 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 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_' 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 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 - name: write the motd
- action: template src=/srv/templates/motd.j2 dest=/etc/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 }} 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 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 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 - name: make a directory
- action: mkdir /tmp/{{ facter_hostname }} - 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 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. 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 }} {{ user }}
For instance, if deploying multiple wordpress instances, I could contain all of my tasks 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: - tasks:
- include: wordpress.yml user=timmy - include: wordpress.yml user=timmy

View file

@ -126,14 +126,20 @@ key in <tt class="docutils literal"><span class="pre">authorized_keys</span></tt
aserver.example.org aserver.example.org
bserver.example.org</pre> bserver.example.org</pre>
</div> </div>
<p>Now try this:</p> <p>Set up SSH agent to avoid retyping passwords:</p>
<blockquote> <div class="highlight-python"><pre>ssh-agent bash
<div>ssh-agent bash ssh-add ~/.ssh/id_rsa</pre>
ssh-add ~/.ssh/id_rsa </div>
ansible all -m ping</div></blockquote> <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 <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 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>
</div> </div>

View file

@ -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-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 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 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. 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.

View file

@ -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-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, 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"> 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> <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>

View file

@ -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="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"> 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>

View file

@ -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> <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 <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> 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 class="highlight-python"><pre>{{ varname }}</pre>
<div>{{ varname }}</div></blockquote> </div>
<p>Further, if there are discovered variables about the system (say, if facter or ohai were <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 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; 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 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> hostname into the /etc/motd file, I could say:</p>
<blockquote> <div class="highlight-python"><pre>- name: write the motd
<div><ul class="simple"> - action: template src=/srv/templates/motd.j2 dest=/etc/motd</pre>
<li>name: write the motd</li> </div>
<li>action: template src=/srv/templates/motd.j2 dest=/etc/motd</li> <p>And in /srv/templates/motd.j2:</p>
</ul>
</div></blockquote>
<p>And in /srv/templates/motd.j2::</p>
<div class="highlight-python"><pre>You are logged into {{ facter_hostname }}</pre> <div class="highlight-python"><pre>You are logged into {{ facter_hostname }}</pre>
</div> </div>
<p>But we&#8217;re getting ahead of ourselves. Let&#8217;s talk about tasks.</p> <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 <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 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> do it like so:</p>
<blockquote> <div class="highlight-python"><pre>- name: make a directory
<div><ul class="simple"> - action: mkdir /tmp/{{ facter_hostname }}</pre>
<li>name: make a directory</li> </div>
<li>action: mkdir /tmp/{{ facter_hostname }}</li>
</ul>
</div></blockquote>
</div> </div>
<div class="section" id="notify-statements"> <div class="section" id="notify-statements">
<h2>Notify statements<a class="headerlink" href="#notify-statements" title="Permalink to this headline"></a></h2> <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> <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 <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. 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> Variables passed in can be deferenced like this (assume a variable named &#8216;user&#8217;):</p>
<blockquote> <div class="highlight-python"><pre>{{ user }}</pre>
<div>{{ user }}</div></blockquote> </div>
<p>For instance, if deploying multiple wordpress instances, I could contain all of my tasks <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> in a wordpress.yml file, and use it like so:</p>
<blockquote> <div class="highlight-python"><pre>- tasks:
<div><ul> - include: wordpress.yml user=timmy
<li><dl class="first docutils"> - include: wordpress.yml user=alice
<dt>tasks:</dt> - include: wordpress.yml user=bob</pre>
<dd><ul class="first last simple"> </div>
<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>
<p>In addition to the explicitly passed in parameters, all variables from the vars section <p>In addition to the explicitly passed in parameters, all variables from the vars section
are also available.</p> are also available.</p>
</div> </div>

File diff suppressed because one or more lines are too long