Until then, to manage your entire site, simply execute all of your playbooks together, in the order desired.
Until then, to manage your entire site, simply execute all of your playbooks together, in the order desired.
You don't have to do this though. It's fine to select sections of your infrastructure to manage at a single time.
You don't have to do this though. It's fine to select sections of your infrastructure to manage at a single time.
...
@@ -92,23 +89,45 @@ keep modules that go with a playbook together.
...
@@ -92,23 +89,45 @@ keep modules that go with a playbook together.
Miscellaneous Tips
Miscellaneous Tips
++++++++++++++++++
++++++++++++++++++
When you can do something simply, do something simply. Do not reach to use every feature of Ansible together, all
When you can do something simply, do something simply. Do not reach
at once. Use what works for you. For example, you should probably not need ``vars``, ``vars_files``, ``vars_prompt`` and ``--extra-vars`` all at once, while also using an external inventory file.
to use every feature of Ansible together, all at once. Use what works
for you. For example, you should probably not need 'vars',
Optimize for readability. Whitespace between sections of YAML documents and in between tasks is strongly encouraged,
'vars_files', 'vars_prompt' and '--extra-vars' all at once,
as is usage of YAML comments, which start with "#". It is also useful to comment at the top of each file the purpose of the individual file and the author, including email address.
while also using an external inventory file.
It is possible to leave off the "name" for a given task, though it is recommended to provide
Optimize for readability. Whitespace between sections of YAML
a descriptive comment about why something is being done instead.
documents and in between tasks is strongly encouraged, as is usage of
YAML comments, which start with '#'. It is also useful to comment
Use version control. Keep your playbooks and inventory file in git (or another version control system), and commit when you make changes to them.
at the top of each file the purpose of the individual file and the
This way you have an audit trail describing when and why you changed the rules automating your infrastructure.
author, including email address.
Resist the urge to write the same playbooks and configuration files for heterogeneous distributions. While lots of software packages claim to make this easy on you, the configuration files are often quite different, to the point where it would be easier to treat them as different playbooks. This is why, for example, Ansible has a seperate 'yum' and 'apt' module. Yum and apt have different capabilities, and we don't want to code for the least common denominator.
It is possible to leave off the 'name' for a given task, though it
is recommended to provide a descriptive comment about why something is
Use variables for user tunable settings versus having constants in the tasks file or templates, so that it is easy to reconfigure a playbook. Think about this as exposing the knobs to things you would like to tweak.
being done instead.
Since a system can be in more than one group, if you have multiple datacenters or sites, consider putting systems into groups by role, but also different groups by geography. This allows you to assign different variables to different geographies.
Use version control. Keep your playbooks and inventory file in git
(or another version control system), and commit when you make changes
to them. This way you have an audit trail describing when and why you
changed the rules automating your infrastructure.
Resist the urge to write the same playbooks and configuration files
for heterogeneous distributions. While lots of software packages
claim to make this easy on you, the configuration files are often
quite different, to the point where it would be easier to treat them
as different playbooks. This is why, for example, Ansible has a
separate :ref:`yum` and :ref:`apt` module. Yum and apt have different
capabilities, and we don't want to code for the least common
denominator.
Use variables for user tunable settings versus having constants in the
tasks file or templates, so that it is easy to reconfigure a playbook.
Think about this as exposing the knobs to things you would like to
tweak.
Since a system can be in more than one group, if you have multiple
datacenters or sites, consider putting systems into groups by role,
but also different groups by geography. This allows you to assign
different variables to different geographies.
.. seealso::
.. seealso::
...
@@ -126,5 +145,3 @@ Since a system can be in more than one group, if you have multiple datacenters o
...
@@ -126,5 +145,3 @@ Since a system can be in more than one group, if you have multiple datacenters o
Complete playbook files from the github project source
Complete playbook files from the github project source
`Mailing List <http://groups.google.com/group/ansible-project>`_
`Mailing List <http://groups.google.com/group/ansible-project>`_
Questions? Help? Ideas? Stop by the list on Google Groups
Questions? Help? Ideas? Stop by the list on Google Groups