Document playbook command for --extra-vars

pull/1256/head
Michael DeHaan 13 years ago
parent fbc48a0d23
commit 6a1c0ca718

@ -298,7 +298,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li> <li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#power-tricks">Power Tricks</a><ul> <li class="toctree-l2"><a class="reference internal" href="playbooks.html#power-tricks">Power Tricks</a><ul>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#external-variables-and-sensitive-data">External Variables And Sensitive Data</a></li> <li class="toctree-l3"><a class="reference internal" href="playbooks.html#external-variables-and-prompted-or-sensitive-data">External Variables And Prompted or Sensitive Data</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-execution">Conditional Execution</a></li> <li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-execution">Conditional Execution</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-imports">Conditional Imports</a></li> <li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-imports">Conditional Imports</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#include-files-and-reuse">Include Files And Reuse</a></li> <li class="toctree-l3"><a class="reference internal" href="playbooks.html#include-files-and-reuse">Include Files And Reuse</a></li>

@ -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="id351907"></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 <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="id555990"></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 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"> 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>

@ -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="id439323"></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="id427444"></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>

@ -139,7 +139,7 @@ s.parentNode.insertBefore(ga, s);
</li> </li>
<li><a class="reference internal" href="#running-operations-on-change">Running Operations On Change</a></li> <li><a class="reference internal" href="#running-operations-on-change">Running Operations On Change</a></li>
<li><a class="reference internal" href="#power-tricks">Power Tricks</a><ul> <li><a class="reference internal" href="#power-tricks">Power Tricks</a><ul>
<li><a class="reference internal" href="#external-variables-and-sensitive-data">External Variables And Sensitive Data</a></li> <li><a class="reference internal" href="#external-variables-and-prompted-or-sensitive-data">External Variables And Prompted or Sensitive Data</a></li>
<li><a class="reference internal" href="#conditional-execution">Conditional Execution</a></li> <li><a class="reference internal" href="#conditional-execution">Conditional Execution</a></li>
<li><a class="reference internal" href="#conditional-imports">Conditional Imports</a></li> <li><a class="reference internal" href="#conditional-imports">Conditional Imports</a></li>
<li><a class="reference internal" href="#include-files-and-reuse">Include Files And Reuse</a></li> <li><a class="reference internal" href="#include-files-and-reuse">Include Files And Reuse</a></li>
@ -356,12 +356,14 @@ won&#8217;t need them for much else.</p>
<h2>Power Tricks<a class="headerlink" href="#power-tricks" title="Permalink to this headline"></a></h2> <h2>Power Tricks<a class="headerlink" href="#power-tricks" title="Permalink to this headline"></a></h2>
<p>Now that you have the basics down, let&#8217;s learn some more advanced <p>Now that you have the basics down, let&#8217;s learn some more advanced
things you can do with playbooks.</p> things you can do with playbooks.</p>
<div class="section" id="external-variables-and-sensitive-data"> <div class="section" id="external-variables-and-prompted-or-sensitive-data">
<h3>External Variables And Sensitive Data<a class="headerlink" href="#external-variables-and-sensitive-data" title="Permalink to this headline"></a></h3> <h3>External Variables And Prompted or Sensitive Data<a class="headerlink" href="#external-variables-and-prompted-or-sensitive-data" title="Permalink to this headline"></a></h3>
<p>It&#8217;s a great idea to keep your playbooks under source control, but <p>It&#8217;s a great idea to keep your playbooks under source control, but
you may wish to make the playbook source public while keeping certain you may wish to make the playbook source public while keeping certain
important variables private. You can do this by using an external important variables private. Similarly, sometimes you may just
variables file, or files, just like this:</p> want to keep certain information in different files, away from
the main playbook.</p>
<p>You can do this by using an external variables file, or files, just like this:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
- hosts: all - hosts: all
user: root user: root
@ -382,7 +384,10 @@ somevar: somevalue
password: magic</pre> password: magic</pre>
</div> </div>
<p>Alternatively, you may wish to prompt the user for certain input, and can <p>Alternatively, you may wish to prompt the user for certain input, and can
do so with the similarly named &#8216;vars_prompt&#8217; section:</p> do so with the similarly named &#8216;vars_prompt&#8217; section. This has uses
beyond security, for instance, you may use the same playbook for all
software releases and would prompt for a particular release version
in a push-script:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
- hosts: all - hosts: all
user: root user: root
@ -394,6 +399,10 @@ do so with the similarly named &#8216;vars_prompt&#8217; section:</p>
favcolor: "what is your favorite color?"</pre> favcolor: "what is your favorite color?"</pre>
</div> </div>
<p>There are full examples of both of these items in the github examples/playbooks directory.</p> <p>There are full examples of both of these items in the github examples/playbooks directory.</p>
<p>Finally, there exists one more option, which feeds variables in from the command line,
rather than sourcing them from the usual means:</p>
<div class="highlight-python"><pre>ansible-playbook foo.yml --extra-vars="release_version=1234 capital_of_assyria=idontknow"</pre>
</div>
</div> </div>
<div class="section" id="conditional-execution"> <div class="section" id="conditional-execution">
<h3>Conditional Execution<a class="headerlink" href="#conditional-execution" title="Permalink to this headline"></a></h3> <h3>Conditional Execution<a class="headerlink" href="#conditional-execution" title="Permalink to this headline"></a></h3>

@ -224,13 +224,16 @@ Now that you have the basics down, let's learn some more advanced
things you can do with playbooks. things you can do with playbooks.
External Variables And Sensitive Data External Variables And Prompted or Sensitive Data
+++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++
It's a great idea to keep your playbooks under source control, but It's a great idea to keep your playbooks under source control, but
you may wish to make the playbook source public while keeping certain you may wish to make the playbook source public while keeping certain
important variables private. You can do this by using an external important variables private. Similarly, sometimes you may just
variables file, or files, just like this:: want to keep certain information in different files, away from
the main playbook.
You can do this by using an external variables file, or files, just like this::
--- ---
- hosts: all - hosts: all
@ -254,7 +257,10 @@ The contents of each variables file is a simple YAML dictionary, like this::
password: magic password: magic
Alternatively, you may wish to prompt the user for certain input, and can Alternatively, you may wish to prompt the user for certain input, and can
do so with the similarly named 'vars_prompt' section:: do so with the similarly named 'vars_prompt' section. This has uses
beyond security, for instance, you may use the same playbook for all
software releases and would prompt for a particular release version
in a push-script::
--- ---
- hosts: all - hosts: all
@ -268,6 +274,11 @@ do so with the similarly named 'vars_prompt' section::
There are full examples of both of these items in the github examples/playbooks directory. There are full examples of both of these items in the github examples/playbooks directory.
Finally, there exists one more option, which feeds variables in from the command line,
rather than sourcing them from the usual means::
ansible-playbook foo.yml --extra-vars="release_version=1234 capital_of_assyria=idontknow"
Conditional Execution Conditional Execution
+++++++++++++++++++++ +++++++++++++++++++++

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