mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Minor docs restructuring
This commit is contained in:
parent
12fd193450
commit
2cafb8d221
22 changed files with 260 additions and 294 deletions
|
@ -23,7 +23,7 @@
|
|||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
|
||||
<link rel="next" title="Playbooks" href="playbooks.html" />
|
||||
<link rel="next" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration" href="playbooks.html" />
|
||||
<link rel="prev" title="Ansible Modules" href="modules.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="playbooks.html" title="Playbooks"
|
||||
<a href="playbooks.html" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="modules.html" title="Ansible Modules"
|
||||
|
@ -143,7 +143,7 @@ languages:
|
|||
title="previous chapter">Ansible Modules</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="playbooks.html"
|
||||
title="next chapter">Playbooks</a></p>
|
||||
title="next chapter">Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/YAMLScripts.txt"
|
||||
|
@ -173,7 +173,7 @@ languages:
|
|||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="playbooks.html" title="Playbooks"
|
||||
<a href="playbooks.html" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="modules.html" title="Ansible Modules"
|
||||
|
|
|
@ -48,6 +48,16 @@ to orchestrate systems in lots of diverse places.
|
|||
Ansible is an GPLv3 licensed open source project, so see the contributions section for how to
|
||||
get involved.
|
||||
|
||||
Communicate and Get Involved
|
||||
````````````````````````````
|
||||
|
||||
* Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
|
||||
* Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
|
||||
* Visit the `project page <https://github.com/ansible/ansible>`_ on Github
|
||||
|
||||
- View the `issue tracker <https://github.com/ansible/ansible/issues>`_
|
||||
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
|
@ -61,5 +71,4 @@ Contents
|
|||
playbooks
|
||||
examples
|
||||
api
|
||||
communicate
|
||||
man
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Ansible Modules
|
||||
===============
|
||||
|
||||
Ansible ships with a number of modules that can be executed directly on remote hosts or through
|
||||
ansible playbooks.
|
||||
|
||||
.. seealso::
|
||||
|
||||
:doc:`examples`
|
||||
|
@ -10,16 +13,8 @@ Ansible Modules
|
|||
:doc:`api`
|
||||
Examples of using modules with the Python API
|
||||
|
||||
|
||||
About Modules
|
||||
`````````````
|
||||
|
||||
Ansible ships with a number of modules that can be executed directly on remote hosts or through
|
||||
ansible playbooks.
|
||||
|
||||
|
||||
Idempotence
|
||||
```````````
|
||||
Module Idempotence
|
||||
```````````````````
|
||||
|
||||
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
|
||||
|
@ -189,7 +184,7 @@ yum
|
|||
This module is in plan.
|
||||
|
||||
|
||||
WRITING YOUR OWN MODULES
|
||||
writing your own modules
|
||||
````````````````````````
|
||||
|
||||
To write your own modules, simply follow the convention of those already available in
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Patterns
|
||||
========
|
||||
The Inventory File, Patterns, and Groups
|
||||
========================================
|
||||
|
||||
How to select hosts you wish to manage
|
||||
|
||||
|
@ -10,6 +10,9 @@ How to select hosts you wish to manage
|
|||
:doc:`playbooks`
|
||||
Learning ansible's configuration management language
|
||||
|
||||
Inventory File Format
|
||||
+++++++++++++++++++++
|
||||
|
||||
Ansible works against multiple systems in your infrastructure at the
|
||||
same time. It does this by selecting portions of systems listed in Ansible's inventory file,
|
||||
which defaults to /etc/ansible/hosts, and looks like this::
|
||||
|
@ -25,45 +28,36 @@ which defaults to /etc/ansible/hosts, and looks like this::
|
|||
two.example.com
|
||||
three.example.com
|
||||
|
||||
Targetting All Systems
|
||||
``````````````````````
|
||||
|
||||
The pattern 'all' or '*' targets all systems in the inventory file.
|
||||
|
||||
Specific Hosts
|
||||
``````````````
|
||||
Selecting Targets
|
||||
+++++++++++++++++
|
||||
|
||||
It is possible to address specific hosts:
|
||||
These patterns target all hosts in the inventory file::
|
||||
|
||||
all
|
||||
*
|
||||
|
||||
It is also possible to address specific hosts::
|
||||
|
||||
one.example.com
|
||||
one.example.com:two.example.com
|
||||
|
||||
Groups
|
||||
``````
|
||||
|
||||
The following patterns address one or more groups:
|
||||
The following patterns address one or more groups, which are denoted with the bracket
|
||||
headers in the inventory file::
|
||||
|
||||
webservers
|
||||
webservers:dbservers
|
||||
|
||||
There is also a magic group 'ungrouped' which selects systems not in a group.
|
||||
|
||||
Wildcards
|
||||
`````````
|
||||
|
||||
Individual hosts, but not groups, can also be referenced using wildcards:
|
||||
|
||||
*.example.com
|
||||
*.com
|
||||
|
||||
Mixing Things Up
|
||||
````````````````
|
||||
|
||||
Specific hosts, wildcards, and groups can all be mixed in the same pattern
|
||||
It's also ok to mix wildcard patterns and groups at the same time::
|
||||
|
||||
one*.com:dbservers
|
||||
|
||||
It is not possible to target a host not in the inventory file.
|
||||
|
||||
NOTE: It is not possible to target a host not in the inventory file.
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Playbooks
|
||||
=========
|
||||
Playbooks: Ansible for Deployment, Configuration Management, and Orchestration
|
||||
==============================================================================
|
||||
|
||||
.. seealso::
|
||||
|
||||
|
@ -11,72 +11,71 @@ Playbooks
|
|||
Learn about how to select hosts
|
||||
|
||||
|
||||
Playbooks are a completely different way to use ansible and are particularly awesome.
|
||||
|
||||
They are the basis for a really simple configuration management and deployment system, unlike any that already exist, and one that is very well suited to deploying complex multi-machine applications. While you might run the main ansible program for ad-hoc tasks, playbooks are more likely to be kept in source control and used to push out your configuration or assure the configurations of your remote systems are in spec.
|
||||
Playbooks are a completely different way to use ansible and are particularly awesome. They are the basis for a really simple configuration management and deployment system, unlike any that already exist, and one that is very well suited to deploying complex multi-machine applications. While you might run the main ansible program for ad-hoc tasks, playbooks are more likely to be kept in source control and used to push out your configuration or assure the configurations of your remote systems are in spec.
|
||||
|
||||
|
||||
Playbook Example
|
||||
````````````````
|
||||
|
||||
Playbooks are expressed in YAML format and have a minimum of syntax. Each playbook is composed
|
||||
of one or more patterns in a list. By composing a playbook of multiple patterns, it is possible
|
||||
of one or more 'plays' in a list. By composing a playbook of multiple 'plays', it is possible
|
||||
to orchestrate multi-machine deployments, running certain steps on all machines in
|
||||
the webservers group, then certain steps on the database server group, then more commands
|
||||
back on the webservers group, etc::
|
||||
|
||||
---
|
||||
- hosts: all
|
||||
vars:
|
||||
http_port: 80
|
||||
max_clients: 200
|
||||
user: root
|
||||
tasks:
|
||||
- include: base.yml somevar=3 othervar=4
|
||||
- name: write the apache config file
|
||||
action: template src=/srv/httpd.j2 dest=/etc/httpd.conf
|
||||
notify:
|
||||
- restart apache
|
||||
- name: ensure apache is running
|
||||
action: service name=httpd state=started
|
||||
handlers:
|
||||
- include: handlers.yml
|
||||
---
|
||||
- hosts: webservers
|
||||
vars:
|
||||
http_port: 80
|
||||
max_clients: 200
|
||||
user: root
|
||||
tasks:
|
||||
- include: base.yml somevar=3 othervar=4
|
||||
- name: write the apache config file
|
||||
action: template src=/srv/httpd.j2 dest=/etc/httpd.conf
|
||||
notify:
|
||||
- restart apache
|
||||
- name: ensure apache is running
|
||||
action: service name=httpd state=started
|
||||
handlers:
|
||||
- include: handlers.yml
|
||||
|
||||
Hosts line
|
||||
``````````
|
||||
|
||||
The hosts line is alist of one or more groups or host patterns, seperated by colons.
|
||||
|
||||
webservers:dbservers:*.foo.example.com
|
||||
The hosts line is alist of one or more groups or host patterns, seperated by colons, as
|
||||
described in the 'patterns' documentation.
|
||||
|
||||
Vars section
|
||||
````````````
|
||||
|
||||
A list of variables that can be used in the 'action' lines of the template, or in
|
||||
included templates. Variables are deferenced like this::
|
||||
A list of variables that can be used in the templates, action lines, or included files.
|
||||
Variables are deferenced using ``jinja2`` syntax like this::
|
||||
|
||||
{{ varname }}
|
||||
|
||||
These variables will be pushed down to the managed systems for use in templating operations.
|
||||
These variables will be pushed down to the managed systems for use in templating operations, where
|
||||
the way to dereference them in templates is exactly the same.
|
||||
|
||||
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 'facter'
|
||||
and Ohai variables are prefixed with 'ohai'.
|
||||
system just like explicitly set variables. Facter variables are prefixed with 'facter_'
|
||||
and Ohai variables are prefixed with 'ohai_'.
|
||||
|
||||
Tasks list
|
||||
``````````
|
||||
|
||||
Tasks are executed in order, one at a time, against all machines matched by the host
|
||||
pattern, before moving on to the next task. Failed tasks are taken out of the rotation.
|
||||
Each play contains a list of tasks. Tasks are executed in order, one at a time, against
|
||||
all machines matched by the play's host pattern, before moving on to the next task.
|
||||
Hosts with failed tasks are taken out of the rotation for the entire playbook. If things fail,
|
||||
correct the problem and rerun. Modules other than command are idempotent, meaning if you
|
||||
run them again, they will make the changes they are told to make to bring the system to
|
||||
the desired state.
|
||||
|
||||
Task name and comment
|
||||
`````````
|
||||
Task name and action
|
||||
`````````````````````
|
||||
|
||||
Each task has a name (required) and optional comment. This is for informational purposes only
|
||||
|
||||
Task action
|
||||
```````````
|
||||
Every task must have a name, which is included in the output from running the playbook.
|
||||
|
||||
The action line is the name of an ansible module followed by parameters. Usually these
|
||||
are expressed in key=value form, except for the command module, which looks just like a Linux/Unix
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
|
||||
<link rel="next" title="Communicate and Get Involved" href="communicate.html" />
|
||||
<link rel="next" title="Man Pages" href="man.html" />
|
||||
<link rel="prev" title="Examples" href="examples.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="communicate.html" title="Communicate and Get Involved"
|
||||
<a href="man.html" title="Man Pages"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="examples.html" title="Examples"
|
||||
|
@ -90,8 +90,8 @@ be used as a framework to rapidly build powerful applications and scripts.</p>
|
|||
<p class="topless"><a href="examples.html"
|
||||
title="previous chapter">Examples</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="communicate.html"
|
||||
title="next chapter">Communicate and Get Involved</a></p>
|
||||
<p class="topless"><a href="man.html"
|
||||
title="next chapter">Man Pages</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/api.txt"
|
||||
|
@ -121,7 +121,7 @@ be used as a framework to rapidly build powerful applications and scripts.</p>
|
|||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="communicate.html" title="Communicate and Get Involved"
|
||||
<a href="man.html" title="Man Pages"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="examples.html" title="Examples"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
|
||||
<link rel="next" title="API" href="api.html" />
|
||||
<link rel="prev" title="Playbooks" href="playbooks.html" />
|
||||
<link rel="prev" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration" href="playbooks.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
|
@ -37,7 +37,7 @@
|
|||
<a href="api.html" title="API"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="playbooks.html" title="Playbooks"
|
||||
<a href="playbooks.html" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="index.html">Ansible v0.0.1 documentation</a> »</li>
|
||||
</ul>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<dl class="last docutils">
|
||||
<dt><a class="reference internal" href="modules.html"><em>Ansible Modules</em></a></dt>
|
||||
<dd>A list of available modules</dd>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</em></a></dt>
|
||||
<dd>Alternative ways to use ansible</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
@ -119,7 +119,7 @@ ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
|
|||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="playbooks.html"
|
||||
title="previous chapter">Playbooks</a></p>
|
||||
title="previous chapter">Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="api.html"
|
||||
title="next chapter">API</a></p>
|
||||
|
@ -155,7 +155,7 @@ ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
|
|||
<a href="api.html" title="API"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="playbooks.html" title="Playbooks"
|
||||
<a href="playbooks.html" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration"
|
||||
>previous</a> |</li>
|
||||
<li><a href="index.html">Ansible v0.0.1 documentation</a> »</li>
|
||||
</ul>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
|
||||
<link rel="next" title="Patterns" href="patterns.html" />
|
||||
<link rel="next" title="The Inventory File, Patterns, and Groups" href="patterns.html" />
|
||||
<link rel="prev" title="Ansible" href="index.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="patterns.html" title="Patterns"
|
||||
<a href="patterns.html" title="The Inventory File, Patterns, and Groups"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="index.html" title="Ansible"
|
||||
|
@ -58,7 +58,7 @@
|
|||
<dd>Examples of basic commands</dd>
|
||||
<dt><a class="reference internal" href="YAMLScripts.html"><em>YAML Scripts</em></a></dt>
|
||||
<dd>Complete documentation of the YAML syntax <cite>ansible</cite> understands for playbooks.</dd>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</em></a></dt>
|
||||
<dd>Learning ansible’s configuration management language</dd>
|
||||
<dt><a class="reference internal" href="modules.html"><em>Ansible Modules</em></a></dt>
|
||||
<dd>Learn about modules that ship with ansible</dd>
|
||||
|
@ -167,7 +167,7 @@ of the more real-world examples.</p>
|
|||
title="previous chapter">Ansible</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="patterns.html"
|
||||
title="next chapter">Patterns</a></p>
|
||||
title="next chapter">The Inventory File, Patterns, and Groups</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/gettingstarted.txt"
|
||||
|
@ -197,7 +197,7 @@ of the more real-world examples.</p>
|
|||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="patterns.html" title="Patterns"
|
||||
<a href="patterns.html" title="The Inventory File, Patterns, and Groups"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="index.html" title="Ansible"
|
||||
|
|
|
@ -83,6 +83,17 @@ to orchestrate systems in lots of diverse places.</p>
|
|||
<p>Ansible is an GPLv3 licensed open source project, so see the contributions section for how to
|
||||
get involved.</p>
|
||||
</div>
|
||||
<div class="section" id="communicate-and-get-involved">
|
||||
<h2>Communicate and Get Involved<a class="headerlink" href="#communicate-and-get-involved" title="Permalink to this headline">¶</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Join the <a class="reference external" href="http://groups.google.com/group/ansible-project">ansible-project mailing list</a> on Google Groups</li>
|
||||
<li>Join <a class="reference external" href="irc://irc.freenode.net/#ansible">#ansible</a> on the <a class="reference external" href="http://freenode.net/">freenode IRC network</a></li>
|
||||
<li>Visit the <a class="reference external" href="https://github.com/ansible/ansible">project page</a> on Github<ul>
|
||||
<li>View the <a class="reference external" href="https://github.com/ansible/ansible/issues">issue tracker</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="contents">
|
||||
<h1>Contents<a class="headerlink" href="#contents" title="Permalink to this headline">¶</a></h1>
|
||||
|
@ -99,17 +110,13 @@ get involved.</p>
|
|||
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#your-first-commands">Your first commands</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="patterns.html">Patterns</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#targetting-all-systems">Targetting All Systems</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#specific-hosts">Specific Hosts</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#groups">Groups</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#wildcards">Wildcards</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#mixing-things-up">Mixing Things Up</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#inventory-file-format">Inventory File Format</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#selecting-targets">Selecting Targets</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#about-modules">About Modules</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#idempotence">Idempotence</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#module-idempotence">Module Idempotence</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#command">command</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#copy">copy</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#facter">facter</a></li>
|
||||
|
@ -121,20 +128,19 @@ get involved.</p>
|
|||
<li class="toctree-l2"><a class="reference internal" href="modules.html#template">template</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#user">user</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#yum">yum</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#writing-your-own-modules">WRITING YOUR OWN MODULES</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#writing-your-own-modules">writing your own modules</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Scripts</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="YAMLScripts.html#yaml-basics">YAML Basics</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a><ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#playbook-example">Playbook Example</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#hosts-line">Hosts line</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#vars-section">Vars section</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#tasks-list">Tasks list</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#task-name-and-comment">Task name and comment</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#task-action">Task action</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#task-name-and-action">Task name and action</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#notify-statements">Notify statements</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#handlers">Handlers</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#includes">Includes</a></li>
|
||||
|
@ -150,7 +156,6 @@ get involved.</p>
|
|||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api.html">API</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="communicate.html">Communicate and Get Involved</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="man.html">Man Pages</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="man.html#ansible-1">ansible(1)</a></li>
|
||||
</ul>
|
||||
|
@ -170,6 +175,7 @@ get involved.</p>
|
|||
<li><a class="reference internal" href="#">Ansible</a><ul>
|
||||
<li><a class="reference internal" href="#design-goals">Design Goals</a></li>
|
||||
<li><a class="reference internal" href="#about-the-author">About the Author</a></li>
|
||||
<li><a class="reference internal" href="#communicate-and-get-involved">Communicate and Get Involved</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#contents">Contents</a><ul>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
|
||||
<link rel="prev" title="Communicate and Get Involved" href="communicate.html" />
|
||||
<link rel="prev" title="API" href="api.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
|
@ -33,7 +33,7 @@
|
|||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="communicate.html" title="Communicate and Get Involved"
|
||||
<a href="api.html" title="API"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="index.html">Ansible v0.0.1 documentation</a> »</li>
|
||||
</ul>
|
||||
|
@ -70,8 +70,8 @@
|
|||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="communicate.html"
|
||||
title="previous chapter">Communicate and Get Involved</a></p>
|
||||
<p class="topless"><a href="api.html"
|
||||
title="previous chapter">API</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/man.txt"
|
||||
|
@ -101,7 +101,7 @@
|
|||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="communicate.html" title="Communicate and Get Involved"
|
||||
<a href="api.html" title="API"
|
||||
>previous</a> |</li>
|
||||
<li><a href="index.html">Ansible v0.0.1 documentation</a> »</li>
|
||||
</ul>
|
||||
|
|
|
@ -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="id326412"></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="id372014"></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="id532031"></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="id447346"></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="id320915"></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 <host-pattern> [-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="id490114"></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 <host-pattern> [-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>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
|
||||
<link rel="next" title="YAML Scripts" href="YAMLScripts.html" />
|
||||
<link rel="prev" title="Patterns" href="patterns.html" />
|
||||
<link rel="prev" title="The Inventory File, Patterns, and Groups" href="patterns.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
|
@ -37,7 +37,7 @@
|
|||
<a href="YAMLScripts.html" title="YAML Scripts"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="patterns.html" title="Patterns"
|
||||
<a href="patterns.html" title="The Inventory File, Patterns, and Groups"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="index.html">Ansible v0.0.1 documentation</a> »</li>
|
||||
</ul>
|
||||
|
@ -50,24 +50,21 @@
|
|||
|
||||
<div class="section" id="ansible-modules">
|
||||
<h1>Ansible Modules<a class="headerlink" href="#ansible-modules" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Ansible ships with a number of modules that can be executed directly on remote hosts or through
|
||||
ansible playbooks.</p>
|
||||
<div class="admonition-see-also admonition seealso">
|
||||
<p class="first admonition-title">See also</p>
|
||||
<dl class="last docutils">
|
||||
<dt><a class="reference internal" href="examples.html"><em>Examples</em></a></dt>
|
||||
<dd>Examples of using modules in /usr/bin/ansible</dd>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</em></a></dt>
|
||||
<dd>Examples of using modules with /usr/bin/ansible-playbook</dd>
|
||||
<dt><a class="reference internal" href="api.html"><em>API</em></a></dt>
|
||||
<dd>Examples of using modules with the Python API</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="about-modules">
|
||||
<h2>About Modules<a class="headerlink" href="#about-modules" title="Permalink to this headline">¶</a></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="section" id="idempotence">
|
||||
<h2>Idempotence<a class="headerlink" href="#idempotence" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="module-idempotence">
|
||||
<h2>Module Idempotence<a class="headerlink" href="#module-idempotence" title="Permalink to this headline">¶</a></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. Unless otherwise noted, all modules support change hooks.</p>
|
||||
|
@ -172,7 +169,7 @@ remote user who does not have permissions on /etc/ansible.</p>
|
|||
<p>This module is in plan.</p>
|
||||
</div>
|
||||
<div class="section" id="writing-your-own-modules">
|
||||
<h2>WRITING YOUR OWN MODULES<a class="headerlink" href="#writing-your-own-modules" title="Permalink to this headline">¶</a></h2>
|
||||
<h2>writing your own modules<a class="headerlink" href="#writing-your-own-modules" title="Permalink to this headline">¶</a></h2>
|
||||
<p>To write your own modules, simply follow the convention of those already available in
|
||||
/usr/share/ansible. Modules must return JSON but can be written in any language.
|
||||
Modules should return hashes, but hashes can be nested.
|
||||
|
@ -192,8 +189,7 @@ describing the nature of the failure. Other values are up to the module.</p>
|
|||
<h3><a href="index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Ansible Modules</a><ul>
|
||||
<li><a class="reference internal" href="#about-modules">About Modules</a></li>
|
||||
<li><a class="reference internal" href="#idempotence">Idempotence</a></li>
|
||||
<li><a class="reference internal" href="#module-idempotence">Module Idempotence</a></li>
|
||||
<li><a class="reference internal" href="#command">command</a></li>
|
||||
<li><a class="reference internal" href="#copy">copy</a></li>
|
||||
<li><a class="reference internal" href="#facter">facter</a></li>
|
||||
|
@ -205,14 +201,14 @@ describing the nature of the failure. Other values are up to the module.</p>
|
|||
<li><a class="reference internal" href="#template">template</a></li>
|
||||
<li><a class="reference internal" href="#user">user</a></li>
|
||||
<li><a class="reference internal" href="#yum">yum</a></li>
|
||||
<li><a class="reference internal" href="#writing-your-own-modules">WRITING YOUR OWN MODULES</a></li>
|
||||
<li><a class="reference internal" href="#writing-your-own-modules">writing your own modules</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="patterns.html"
|
||||
title="previous chapter">Patterns</a></p>
|
||||
title="previous chapter">The Inventory File, Patterns, and Groups</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="YAMLScripts.html"
|
||||
title="next chapter">YAML Scripts</a></p>
|
||||
|
@ -248,7 +244,7 @@ describing the nature of the failure. Other values are up to the module.</p>
|
|||
<a href="YAMLScripts.html" title="YAML Scripts"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="patterns.html" title="Patterns"
|
||||
<a href="patterns.html" title="The Inventory File, Patterns, and Groups"
|
||||
>previous</a> |</li>
|
||||
<li><a href="index.html">Ansible v0.0.1 documentation</a> »</li>
|
||||
</ul>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Patterns — Ansible v0.0.1 documentation</title>
|
||||
<title>The Inventory File, Patterns, and Groups — Ansible v0.0.1 documentation</title>
|
||||
<link rel="stylesheet" href="_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
|
@ -48,18 +48,20 @@
|
|||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="patterns">
|
||||
<h1>Patterns<a class="headerlink" href="#patterns" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="the-inventory-file-patterns-and-groups">
|
||||
<h1>The Inventory File, Patterns, and Groups<a class="headerlink" href="#the-inventory-file-patterns-and-groups" title="Permalink to this headline">¶</a></h1>
|
||||
<p>How to select hosts you wish to manage</p>
|
||||
<div class="admonition-see-also admonition seealso">
|
||||
<p class="first admonition-title">See also</p>
|
||||
<dl class="last docutils">
|
||||
<dt><a class="reference internal" href="examples.html"><em>Examples</em></a></dt>
|
||||
<dd>Examples of basic commands</dd>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
|
||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</em></a></dt>
|
||||
<dd>Learning ansible’s configuration management language</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="inventory-file-format">
|
||||
<h2>Inventory File Format<a class="headerlink" href="#inventory-file-format" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Ansible works against multiple systems in your infrastructure at the
|
||||
same time. It does this by selecting portions of systems listed in Ansible’s inventory file,
|
||||
which defaults to /etc/ansible/hosts, and looks like this:</p>
|
||||
|
@ -75,38 +77,30 @@ which defaults to /etc/ansible/hosts, and looks like this:</p>
|
|||
<span class="n">three</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="section" id="targetting-all-systems">
|
||||
<h2>Targetting All Systems<a class="headerlink" href="#targetting-all-systems" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The pattern ‘all’ or ‘*’ targets all systems in the inventory file.</p>
|
||||
</div>
|
||||
<div class="section" id="specific-hosts">
|
||||
<h2>Specific Hosts<a class="headerlink" href="#specific-hosts" title="Permalink to this headline">¶</a></h2>
|
||||
<p>It is possible to address specific hosts:</p>
|
||||
<blockquote>
|
||||
<div>one.example.com
|
||||
one.example.com:two.example.com</div></blockquote>
|
||||
<div class="section" id="selecting-targets">
|
||||
<h2>Selecting Targets<a class="headerlink" href="#selecting-targets" title="Permalink to this headline">¶</a></h2>
|
||||
<p>These patterns target all hosts in the inventory file:</p>
|
||||
<div class="highlight-python"><pre>all
|
||||
*</pre>
|
||||
</div>
|
||||
<div class="section" id="groups">
|
||||
<h2>Groups<a class="headerlink" href="#groups" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The following patterns address one or more groups:</p>
|
||||
<blockquote>
|
||||
<div>webservers
|
||||
webservers:dbservers</div></blockquote>
|
||||
<p>There is also a magic group ‘ungrouped’ which selects systems not in a group.</p>
|
||||
<p>It is also possible to address specific hosts:</p>
|
||||
<div class="highlight-python"><pre>one.example.com
|
||||
one.example.com:two.example.com</pre>
|
||||
</div>
|
||||
<p>The following patterns address one or more groups, which are denoted with the bracket
|
||||
headers in the inventory file:</p>
|
||||
<div class="highlight-python"><pre>webservers
|
||||
webservers:dbservers</pre>
|
||||
</div>
|
||||
<div class="section" id="wildcards">
|
||||
<h2>Wildcards<a class="headerlink" href="#wildcards" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Individual hosts, but not groups, can also be referenced using wildcards:</p>
|
||||
<blockquote>
|
||||
<div><a href="#id1"><span class="problematic" id="id2">*</span></a>.example.com
|
||||
<a href="#id3"><span class="problematic" id="id4">*</span></a>.com</div></blockquote>
|
||||
<p>It’s also ok to mix wildcard patterns and groups at the same time:</p>
|
||||
<div class="highlight-python"><pre>one*.com:dbservers</pre>
|
||||
</div>
|
||||
<div class="section" id="mixing-things-up">
|
||||
<h2>Mixing Things Up<a class="headerlink" href="#mixing-things-up" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Specific hosts, wildcards, and groups can all be mixed in the same pattern</p>
|
||||
<blockquote>
|
||||
<div>one*.com:dbservers</div></blockquote>
|
||||
<p>It is not possible to target a host not in the inventory file.</p>
|
||||
<p>NOTE: It is not possible to target a host not in the inventory file.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -118,12 +112,9 @@ webservers:dbservers</div></blockquote>
|
|||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Patterns</a><ul>
|
||||
<li><a class="reference internal" href="#targetting-all-systems">Targetting All Systems</a></li>
|
||||
<li><a class="reference internal" href="#specific-hosts">Specific Hosts</a></li>
|
||||
<li><a class="reference internal" href="#groups">Groups</a></li>
|
||||
<li><a class="reference internal" href="#wildcards">Wildcards</a></li>
|
||||
<li><a class="reference internal" href="#mixing-things-up">Mixing Things Up</a></li>
|
||||
<li><a class="reference internal" href="#">The Inventory File, Patterns, and Groups</a><ul>
|
||||
<li><a class="reference internal" href="#inventory-file-format">Inventory File Format</a></li>
|
||||
<li><a class="reference internal" href="#selecting-targets">Selecting Targets</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Playbooks — Ansible v0.0.1 documentation</title>
|
||||
<title>Playbooks: Ansible for Deployment, Configuration Management, and Orchestration — Ansible v0.0.1 documentation</title>
|
||||
<link rel="stylesheet" href="_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
|
@ -48,8 +48,8 @@
|
|||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="playbooks">
|
||||
<h1>Playbooks<a class="headerlink" href="#playbooks" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="playbooks-ansible-for-deployment-configuration-management-and-orchestration">
|
||||
<h1>Playbooks: Ansible for Deployment, Configuration Management, and Orchestration<a class="headerlink" href="#playbooks-ansible-for-deployment-configuration-management-and-orchestration" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition-see-also admonition seealso">
|
||||
<p class="first admonition-title">See also</p>
|
||||
<dl class="last docutils">
|
||||
|
@ -57,78 +57,66 @@
|
|||
<dd>Learn about YAML syntax</dd>
|
||||
<dt><a class="reference internal" href="modules.html"><em>Ansible Modules</em></a></dt>
|
||||
<dd>Learn about available modules and writing your own</dd>
|
||||
<dt><a class="reference internal" href="patterns.html"><em>Patterns</em></a></dt>
|
||||
<dt><a class="reference internal" href="patterns.html"><em>The Inventory File, Patterns, and Groups</em></a></dt>
|
||||
<dd>Learn about how to select hosts</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>Playbooks are a completely different way to use ansible and are particularly awesome.</p>
|
||||
<p>They are the basis for a really simple configuration management and deployment system, unlike any that already exist, and one that is very well suited to deploying complex multi-machine applications. While you might run the main ansible program for ad-hoc tasks, playbooks are more likely to be kept in source control and used to push out your configuration or assure the configurations of your remote systems are in spec.</p>
|
||||
<p>Playbooks are a completely different way to use ansible and are particularly awesome. They are the basis for a really simple configuration management and deployment system, unlike any that already exist, and one that is very well suited to deploying complex multi-machine applications. While you might run the main ansible program for ad-hoc tasks, playbooks are more likely to be kept in source control and used to push out your configuration or assure the configurations of your remote systems are in spec.</p>
|
||||
<div class="section" id="playbook-example">
|
||||
<h2>Playbook Example<a class="headerlink" href="#playbook-example" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Playbooks are expressed in YAML format and have a minimum of syntax. Each playbook is composed
|
||||
of one or more patterns in a list. By composing a playbook of multiple patterns, it is possible
|
||||
of one or more ‘plays’ in a list. By composing a playbook of multiple ‘plays’, it is possible
|
||||
to orchestrate multi-machine deployments, running certain steps on all machines in
|
||||
the webservers group, then certain steps on the database server group, then more commands
|
||||
back on the webservers group, etc:</p>
|
||||
<div class="highlight-python"><pre>---
|
||||
- hosts: all</pre>
|
||||
- hosts: webservers
|
||||
vars:
|
||||
http_port: 80
|
||||
max_clients: 200
|
||||
user: root
|
||||
tasks:
|
||||
- include: base.yml somevar=3 othervar=4
|
||||
- name: write the apache config file
|
||||
action: template src=/srv/httpd.j2 dest=/etc/httpd.conf
|
||||
notify:
|
||||
- restart apache
|
||||
- name: ensure apache is running
|
||||
action: service name=httpd state=started
|
||||
handlers:
|
||||
- include: handlers.yml</pre>
|
||||
</div>
|
||||
<blockquote>
|
||||
<div><dl class="docutils">
|
||||
<dt>vars:</dt>
|
||||
<dd>http_port: 80
|
||||
max_clients: 200</dd>
|
||||
</dl>
|
||||
<p>user: root
|
||||
tasks:
|
||||
- include: base.yml somevar=3 othervar=4
|
||||
- name: write the apache config file</p>
|
||||
<blockquote>
|
||||
<div>action: template src=/srv/httpd.j2 dest=/etc/httpd.conf
|
||||
notify:
|
||||
- restart apache</div></blockquote>
|
||||
<ul class="simple">
|
||||
<li>name: ensure apache is running
|
||||
action: service name=httpd state=started</li>
|
||||
</ul>
|
||||
<dl class="docutils">
|
||||
<dt>handlers:</dt>
|
||||
<dd><ul class="first last simple">
|
||||
<li>include: handlers.yml</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</div>
|
||||
<div class="section" id="hosts-line">
|
||||
<h2>Hosts line<a class="headerlink" href="#hosts-line" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The hosts line is alist of one or more groups or host patterns, seperated by colons.</p>
|
||||
<blockquote>
|
||||
<div>webservers:dbservers:<a href="#id1"><span class="problematic" id="id2">*</span></a>.foo.example.com</div></blockquote>
|
||||
<p>The hosts line is alist of one or more groups or host patterns, seperated by colons, as
|
||||
described in the ‘patterns’ documentation.</p>
|
||||
</div>
|
||||
<div class="section" id="vars-section">
|
||||
<h2>Vars section<a class="headerlink" href="#vars-section" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A list of variables that can be used in the ‘action’ lines of the template, or in
|
||||
included templates. Variables are deferenced like this:</p>
|
||||
<p>A list of variables that can be used in the templates, action lines, or included files.
|
||||
Variables are deferenced using <tt class="docutils literal"><span class="pre">jinja2</span></tt> syntax like this:</p>
|
||||
<div class="highlight-python"><pre>{{ varname }}</pre>
|
||||
</div>
|
||||
<p>These variables will be pushed down to the managed systems for use in templating operations.</p>
|
||||
<p>These variables will be pushed down to the managed systems for use in templating operations, where
|
||||
the way to dereference them in templates is exactly the same.</p>
|
||||
<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 ‘facter’
|
||||
and Ohai variables are prefixed with ‘ohai’.</p>
|
||||
system just like explicitly set variables. Facter variables are prefixed with ‘<a href="#id1"><span class="problematic" id="id2">facter_</span></a>‘
|
||||
and Ohai variables are prefixed with ‘<a href="#id3"><span class="problematic" id="id4">ohai_</span></a>‘.</p>
|
||||
</div>
|
||||
<div class="section" id="tasks-list">
|
||||
<h2>Tasks list<a class="headerlink" href="#tasks-list" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Tasks are executed in order, one at a time, against all machines matched by the host
|
||||
pattern, before moving on to the next task. Failed tasks are taken out of the rotation.</p>
|
||||
<p>Each play contains a list of tasks. Tasks are executed in order, one at a time, against
|
||||
all machines matched by the play’s host pattern, before moving on to the next task.
|
||||
Hosts with failed tasks are taken out of the rotation for the entire playbook. If things fail,
|
||||
correct the problem and rerun. Modules other than command are idempotent, meaning if you
|
||||
run them again, they will make the changes they are told to make to bring the system to
|
||||
the desired state.</p>
|
||||
</div>
|
||||
<div class="section" id="task-name-and-comment">
|
||||
<h2>Task name and comment<a class="headerlink" href="#task-name-and-comment" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Each task has a name (required) and optional comment. This is for informational purposes only</p>
|
||||
</div>
|
||||
<div class="section" id="task-action">
|
||||
<h2>Task action<a class="headerlink" href="#task-action" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="task-name-and-action">
|
||||
<h2>Task name and action<a class="headerlink" href="#task-name-and-action" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Every task must have a name, which is included in the output from running the playbook.</p>
|
||||
<p>The action line is the name of an ansible module followed by parameters. Usually these
|
||||
are expressed in key=value form, except for the command module, which looks just like a Linux/Unix
|
||||
command line. See the module documentation for more info.</p>
|
||||
|
@ -172,13 +160,12 @@ Variables passed in can be deferenced like this:</p>
|
|||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Playbooks</a><ul>
|
||||
<li><a class="reference internal" href="#">Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</a><ul>
|
||||
<li><a class="reference internal" href="#playbook-example">Playbook Example</a></li>
|
||||
<li><a class="reference internal" href="#hosts-line">Hosts line</a></li>
|
||||
<li><a class="reference internal" href="#vars-section">Vars section</a></li>
|
||||
<li><a class="reference internal" href="#tasks-list">Tasks list</a></li>
|
||||
<li><a class="reference internal" href="#task-name-and-comment">Task name and comment</a></li>
|
||||
<li><a class="reference internal" href="#task-action">Task action</a></li>
|
||||
<li><a class="reference internal" href="#task-name-and-action">Task name and action</a></li>
|
||||
<li><a class="reference internal" href="#notify-statements">Notify statements</a></li>
|
||||
<li><a class="reference internal" href="#handlers">Handlers</a></li>
|
||||
<li><a class="reference internal" href="#includes">Includes</a></li>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +0,0 @@
|
|||
Communicate and Get Involved
|
||||
===========================
|
||||
|
||||
* Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
|
||||
* Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
|
||||
* Visit the `project page <https://github.com/ansible/ansible>`_ on Github
|
||||
|
||||
- View the `issue tracker <https://github.com/ansible/ansible/issues>`_
|
||||
|
|
@ -35,18 +35,15 @@ Design Goals
|
|||
* Be usable as non-root
|
||||
* Create the easiest config management system to use, ever.
|
||||
|
||||
About the Author
|
||||
````````````````
|
||||
Communicate and Get Involved
|
||||
````````````````````````````
|
||||
|
||||
Michael DeHaan is a Raleigh, NC based software developer and architect. He created other
|
||||
DevOps programs such as Cobbler, the popular Linux install server.
|
||||
Cobbler is used to deploy mission critical systems all over the planet, in industries
|
||||
ranging from massively multiplayer gaming, core internet infrastructure, finance,
|
||||
chip design, and more. Michael also helped co-author of Func, which is used
|
||||
to orchestrate systems in lots of diverse places.
|
||||
* Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
|
||||
* Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
|
||||
* Visit the `project page <https://github.com/ansible/ansible>`_ on Github
|
||||
|
||||
- View the `issue tracker <https://github.com/ansible/ansible/issues>`_
|
||||
|
||||
Ansible is an GPLv3 licensed open source project, so see the contributions section for how to
|
||||
get involved.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
@ -61,5 +58,18 @@ Contents
|
|||
playbooks
|
||||
examples
|
||||
api
|
||||
communicate
|
||||
man
|
||||
|
||||
About the Author
|
||||
````````````````
|
||||
|
||||
Michael DeHaan is a Raleigh, NC based software developer and architect. He created other
|
||||
DevOps programs such as Cobbler, the popular Linux install server.
|
||||
Cobbler is used to deploy mission critical systems all over the planet, in industries
|
||||
ranging from massively multiplayer gaming, core internet infrastructure, finance,
|
||||
chip design, and more. Michael also helped co-author of Func, which is used
|
||||
to orchestrate systems in lots of diverse places.
|
||||
|
||||
Ansible is an GPLv3 licensed open source project, so see the contributions section for how to
|
||||
get involved.
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Ansible Modules
|
||||
===============
|
||||
|
||||
Ansible ships with a number of modules that can be executed directly on remote hosts or through
|
||||
ansible playbooks.
|
||||
|
||||
.. seealso::
|
||||
|
||||
:doc:`examples`
|
||||
|
@ -10,16 +13,8 @@ Ansible Modules
|
|||
:doc:`api`
|
||||
Examples of using modules with the Python API
|
||||
|
||||
|
||||
About Modules
|
||||
`````````````
|
||||
|
||||
Ansible ships with a number of modules that can be executed directly on remote hosts or through
|
||||
ansible playbooks.
|
||||
|
||||
|
||||
Idempotence
|
||||
```````````
|
||||
Module Idempotence
|
||||
```````````````````
|
||||
|
||||
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
|
||||
|
@ -189,7 +184,7 @@ yum
|
|||
This module is in plan.
|
||||
|
||||
|
||||
WRITING YOUR OWN MODULES
|
||||
writing your own modules
|
||||
````````````````````````
|
||||
|
||||
To write your own modules, simply follow the convention of those already available in
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Patterns
|
||||
========
|
||||
The Inventory File, Patterns, and Groups
|
||||
========================================
|
||||
|
||||
How to select hosts you wish to manage
|
||||
|
||||
|
@ -10,6 +10,9 @@ How to select hosts you wish to manage
|
|||
:doc:`playbooks`
|
||||
Learning ansible's configuration management language
|
||||
|
||||
Inventory File Format
|
||||
+++++++++++++++++++++
|
||||
|
||||
Ansible works against multiple systems in your infrastructure at the
|
||||
same time. It does this by selecting portions of systems listed in Ansible's inventory file,
|
||||
which defaults to /etc/ansible/hosts, and looks like this::
|
||||
|
@ -25,45 +28,36 @@ which defaults to /etc/ansible/hosts, and looks like this::
|
|||
two.example.com
|
||||
three.example.com
|
||||
|
||||
Targetting All Systems
|
||||
``````````````````````
|
||||
|
||||
The pattern 'all' or '*' targets all systems in the inventory file.
|
||||
|
||||
Specific Hosts
|
||||
``````````````
|
||||
Selecting Targets
|
||||
+++++++++++++++++
|
||||
|
||||
It is possible to address specific hosts:
|
||||
These patterns target all hosts in the inventory file::
|
||||
|
||||
all
|
||||
*
|
||||
|
||||
It is also possible to address specific hosts::
|
||||
|
||||
one.example.com
|
||||
one.example.com:two.example.com
|
||||
|
||||
Groups
|
||||
``````
|
||||
|
||||
The following patterns address one or more groups:
|
||||
The following patterns address one or more groups, which are denoted with the bracket
|
||||
headers in the inventory file::
|
||||
|
||||
webservers
|
||||
webservers:dbservers
|
||||
|
||||
There is also a magic group 'ungrouped' which selects systems not in a group.
|
||||
|
||||
Wildcards
|
||||
`````````
|
||||
|
||||
Individual hosts, but not groups, can also be referenced using wildcards:
|
||||
|
||||
*.example.com
|
||||
*.com
|
||||
|
||||
Mixing Things Up
|
||||
````````````````
|
||||
|
||||
Specific hosts, wildcards, and groups can all be mixed in the same pattern
|
||||
It's also ok to mix wildcard patterns and groups at the same time::
|
||||
|
||||
one*.com:dbservers
|
||||
|
||||
It is not possible to target a host not in the inventory file.
|
||||
|
||||
NOTE: It is not possible to target a host not in the inventory file.
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Playbooks
|
||||
=========
|
||||
Playbooks: Ansible for Deployment, Configuration Management, and Orchestration
|
||||
==============================================================================
|
||||
|
||||
.. seealso::
|
||||
|
||||
|
@ -11,22 +11,20 @@ Playbooks
|
|||
Learn about how to select hosts
|
||||
|
||||
|
||||
Playbooks are a completely different way to use ansible and are particularly awesome.
|
||||
|
||||
They are the basis for a really simple configuration management and deployment system, unlike any that already exist, and one that is very well suited to deploying complex multi-machine applications. While you might run the main ansible program for ad-hoc tasks, playbooks are more likely to be kept in source control and used to push out your configuration or assure the configurations of your remote systems are in spec.
|
||||
Playbooks are a completely different way to use ansible and are particularly awesome. They are the basis for a really simple configuration management and deployment system, unlike any that already exist, and one that is very well suited to deploying complex multi-machine applications. While you might run the main ansible program for ad-hoc tasks, playbooks are more likely to be kept in source control and used to push out your configuration or assure the configurations of your remote systems are in spec.
|
||||
|
||||
|
||||
Playbook Example
|
||||
````````````````
|
||||
|
||||
Playbooks are expressed in YAML format and have a minimum of syntax. Each playbook is composed
|
||||
of one or more patterns in a list. By composing a playbook of multiple patterns, it is possible
|
||||
of one or more 'plays' in a list. By composing a playbook of multiple 'plays', it is possible
|
||||
to orchestrate multi-machine deployments, running certain steps on all machines in
|
||||
the webservers group, then certain steps on the database server group, then more commands
|
||||
back on the webservers group, etc::
|
||||
|
||||
---
|
||||
- hosts: all
|
||||
- hosts: webservers
|
||||
vars:
|
||||
http_port: 80
|
||||
max_clients: 200
|
||||
|
@ -45,38 +43,39 @@ back on the webservers group, etc::
|
|||
Hosts line
|
||||
``````````
|
||||
|
||||
The hosts line is alist of one or more groups or host patterns, seperated by colons.::
|
||||
|
||||
webservers:dbservers:*.foo.example.com
|
||||
The hosts line is alist of one or more groups or host patterns, seperated by colons, as
|
||||
described in the 'patterns' documentation.
|
||||
|
||||
Vars section
|
||||
````````````
|
||||
|
||||
A list of variables that can be used in the 'action' lines of the template, or in
|
||||
included templates. Variables are deferenced like this::
|
||||
A list of variables that can be used in the templates, action lines, or included files.
|
||||
Variables are deferenced using ``jinja2`` syntax like this::
|
||||
|
||||
{{ varname }}
|
||||
|
||||
These variables will be pushed down to the managed systems for use in templating operations.
|
||||
These variables will be pushed down to the managed systems for use in templating operations, where
|
||||
the way to dereference them in templates is exactly the same.
|
||||
|
||||
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 'facter'
|
||||
and Ohai variables are prefixed with 'ohai'.
|
||||
system just like explicitly set variables. Facter variables are prefixed with 'facter_'
|
||||
and Ohai variables are prefixed with 'ohai_'.
|
||||
|
||||
Tasks list
|
||||
``````````
|
||||
|
||||
Tasks are executed in order, one at a time, against all machines matched by the host
|
||||
pattern, before moving on to the next task. Failed tasks are taken out of the rotation.
|
||||
Each play contains a list of tasks. Tasks are executed in order, one at a time, against
|
||||
all machines matched by the play's host pattern, before moving on to the next task.
|
||||
Hosts with failed tasks are taken out of the rotation for the entire playbook. If things fail,
|
||||
correct the problem and rerun. Modules other than command are idempotent, meaning if you
|
||||
run them again, they will make the changes they are told to make to bring the system to
|
||||
the desired state.
|
||||
|
||||
Task name and comment
|
||||
`````````
|
||||
Task name and action
|
||||
`````````````````````
|
||||
|
||||
Each task has a name (required) and optional comment. This is for informational purposes only
|
||||
|
||||
Task action
|
||||
```````````
|
||||
Every task must have a name, which is included in the output from running the playbook.
|
||||
|
||||
The action line is the name of an ansible module followed by parameters. Usually these
|
||||
are expressed in key=value form, except for the command module, which looks just like a Linux/Unix
|
||||
|
|
Loading…
Reference in a new issue