/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Administration/Server/Provisioning/ansible/inventory.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2017-04-03 02:45:17 UTC
  • Revision ID: csa@suren.me-20170403024517-dwzj0z0k1cmhxm7u
Restructuring, OpenShift, Ansible, Git

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Inventory
 
2
=========
 
3
 Allows to define group of nodes and set parameters (facts). This group of nodes, then, are used in playbooks and roles
 
4
 to configure specific services. Standard ini file format is used.
 
5
 
 
6
 [group1]                                                       - defines a group of nodes
 
7
 node.org                                                       - just a signle node
 
8
 node.org var1=val1 var2=val2                                   - add nodes and sets some facts about it
 
9
 node[1:3].org                                                  - add to group multiple nodes with similar names
 
10
 
 
11
 [multi-group:children]                                         - define a group of ndoes which assembled from other groups
 
12
 group1
 
13
 group2
 
14
 
 
15
 [group1:vars]                                                  - define variables for all nodes in the group
 
16
 var1=val1
 
17
 var2=val2
 
18
 
 
19
 
 
20
 
 
21
Using groups
 
22
============
 
23
 - name: Execute set of tasks on specified group of nodes
 
24
   hosts: group1                                                - all nodes belongign to group1
 
25
   hosts: group1:group2                                         - all nodes belonging to either group1 or group2 (or both)
 
26
   hosts: group1:group2:!group3                                 - all nodes belonging to group1 or group2, but not belonging to group3
 
27
 
 
28
 
 
29
 Looping over inventory
 
30
 ----------------------
 
31
  - mod: <params>                                               - The node params can be addressed like hostvars[item]['openshift_hostname']
 
32
    with_inventory_hostnames: [ 'nodes' ]                       
 
33
 
 
34
 
 
35
Virtual groups
 
36
==============
 
37
 Normally, the groups are used to specify types of nodes 'web-servers', 'databases' to perform specific configuration tasks. However, often
 
38
 there is multiple types of setups. Lets say staging setup for devlopment and production setup. So, the nodes could be grouped in multiple 
 
39
 ways web vs database or staging vs production. We would define all relevant group of nodes sharing common parameters (all 4 types: web, db,
 
40
 staging, production) and set these parameters in the files in 'group_vars' folder. Then, the included inventory will specify what have to
 
41
 be configured in the specific setup.
 
42
 
 
 
b'\\ No newline at end of file'