Ansible Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 28: Line 28:


The headings in brackets are ''group names'', which are used in classifying systems and deciding what systems you are controlling at what times and for what purpose. A host can be part of more than one group.
The headings in brackets are ''group names'', which are used in classifying systems and deciding what systems you are controlling at what times and for what purpose. A host can be part of more than one group.
==Group Variables==
To be applied to an entire group at once, variables should be declared as follows:
<PRE>
[group-A]
host1
host2
[group-A:vars]
something=something-else
</PRE>
==Host Variables==


=Playbook=
=Playbook=

Revision as of 00:59, 16 May 2017

Internal

Inventory File

Ansible works against multiple systems at the same time. It does this by selecting portions of systems listed in Ansible’s inventory file. The default location of the inventory file is /etc/ansible/hosts.

A different location of the inventory file can be specified on the command line with:

-i <path>

Inventory File Structure

host1.example.com

[webservers]
web1.example.com
web2.example.com

[dbservers]
db1.example.com
db2.example.com

The headings in brackets are group names, which are used in classifying systems and deciding what systems you are controlling at what times and for what purpose. A host can be part of more than one group.

Group Variables

To be applied to an entire group at once, variables should be declared as follows:

[group-A]
host1
host2

[group-A:vars]
something=something-else

Host Variables

Playbook