Clearer examples of hosts.yml inventory (#57999)
* Clearer examples of hosts.yml inventory
This commit is contained in:
parent
8646b6953d
commit
751134ff17
1 changed files with 34 additions and 23 deletions
|
@ -14,7 +14,7 @@
|
||||||
# - You can enter hostnames or IP addresses
|
# - You can enter hostnames or IP addresses
|
||||||
# - A hostname/IP can be a member of multiple groups
|
# - A hostname/IP can be a member of multiple groups
|
||||||
|
|
||||||
# Ex 1: Ungrouped hosts, put them in 'all' or 'ungrouped' group
|
# Ex 1: Ungrouped hosts, put them in 'all' or 'ungrouped' group, defines 4 hosts, one with 2 variables
|
||||||
##all:
|
##all:
|
||||||
## hosts:
|
## hosts:
|
||||||
## green.example.com:
|
## green.example.com:
|
||||||
|
@ -24,35 +24,46 @@
|
||||||
## 192.168.100.1:
|
## 192.168.100.1:
|
||||||
## 192.168.100.10:
|
## 192.168.100.10:
|
||||||
|
|
||||||
# Ex 2: A collection of hosts belonging to the 'webservers' group
|
# Ex 2: A collection of hosts belonging to the 'webservers' group, with shared group var
|
||||||
## children:
|
##webservers:
|
||||||
## webservers:
|
## hosts:
|
||||||
## hosts:
|
## alpha.example.org:
|
||||||
## alpha.example.org:
|
## beta.example.org:
|
||||||
## beta.example.org:
|
## 192.168.1.100:
|
||||||
## 192.168.1.100:
|
## 192.168.1.110:
|
||||||
## 192.168.1.110:
|
## vars:
|
||||||
|
## http_port: 8080
|
||||||
|
|
||||||
# Ex 3: You can create hosts using ranges and add children groups and vars to a group
|
# Ex 3: You can create hosts using ranges and add children groups and vars to a group
|
||||||
# The child group can define anything you would normally add to a group.
|
# The child group can define anything you would normally add to a group.
|
||||||
# webservers is added as a child group of testing. gamma.example.org is added
|
# Hosts in child groups inherit all variables from parent, parents include all hosts in child groups.
|
||||||
# to the existing webservers group. All references to webservers will
|
# webservers is added as a child group of testing, so all gamma hosts (1-3) are added
|
||||||
# get alpha.example.org, beta.example.org, gamma.example.org, 192.168.1.100
|
# to the 'webservers' group, including gamma3, which is defined in the tree of another parent group.
|
||||||
# and 192.168.1.110. References to testing will get all of those hosts plus
|
# All references to webservers will get any hosts defined under webservers.
|
||||||
# any host matching www[001:006].example.com
|
# References to testing will get all of those hosts plus any host matching www[001:006].example.com
|
||||||
|
|
||||||
## testing:
|
##webservers:
|
||||||
## hosts:
|
## hosts:
|
||||||
## www[001:006].example.com:
|
## gamma1.example.org:
|
||||||
## vars:
|
## gamma2.example.org:
|
||||||
## testing1: value1
|
##testing:
|
||||||
## children:
|
## hosts:
|
||||||
## webservers:
|
## www[001:006].example.com:
|
||||||
## hosts:
|
## vars:
|
||||||
## gamma.example.org:
|
## testing1: value1
|
||||||
|
## children:
|
||||||
|
## webservers:
|
||||||
|
##other:
|
||||||
|
## children:
|
||||||
|
## webservers:
|
||||||
|
## gamma3.example.org
|
||||||
|
|
||||||
|
# From above, the testing group contains: gamma1.example.org gamma2.example.org gamma3.example.org www001.example.com www002.example.com www003.example.com www004.example.com www005.example.com www006.example.com
|
||||||
|
|
||||||
# Ex 4: all vars
|
# Ex 4: all vars
|
||||||
# keeping within 'all' group you can define common 'all' vars here with lowest precedence
|
# keeping within 'all' group you can define common 'all' vars here with lowest precedence
|
||||||
|
|
||||||
|
|
||||||
|
##all:
|
||||||
## vars:
|
## vars:
|
||||||
## commontoall: thisvar
|
## commontoall: thisvar
|
||||||
|
|
Loading…
Reference in a new issue