2016-04-07 22:22:36 +02:00
|
|
|
# This is the default ansible 'hosts' file.
|
|
|
|
#
|
|
|
|
# It should live in /etc/ansible/hosts
|
|
|
|
#
|
|
|
|
# - Comments begin with the '#' character
|
|
|
|
# - Blank lines are ignored
|
2017-03-08 20:51:38 +01:00
|
|
|
# - Top level entries are assumed to be groups, start with 'all' to have a full hierchy
|
2016-04-07 22:22:36 +02:00
|
|
|
# - Hosts must be specified in a group's hosts:
|
|
|
|
# and they must be a key (: terminated)
|
|
|
|
# - groups can have children, hosts and vars keys
|
|
|
|
# - Anything defined under a hosts is assumed to be a var
|
|
|
|
# - You can enter hostnames or ip addresses
|
|
|
|
# - A hostname/ip can be a member of multiple groups
|
2017-03-08 20:51:38 +01:00
|
|
|
|
|
|
|
# Ex 1: Ungrouped hosts, put in 'all' or 'ungrouped' group
|
|
|
|
##all:
|
2016-04-07 22:22:36 +02:00
|
|
|
## hosts:
|
|
|
|
## green.example.com:
|
|
|
|
## ansible_ssh_host: 191.168.100.32
|
2017-05-12 00:01:20 +02:00
|
|
|
## anyvariable: value
|
2016-04-07 22:22:36 +02:00
|
|
|
## blue.example.com:
|
|
|
|
## 192.168.100.1:
|
|
|
|
## 192.168.100.10:
|
|
|
|
|
|
|
|
# Ex 2: A collection of hosts belonging to the 'webservers' group
|
2017-03-08 20:51:38 +01:00
|
|
|
## children:
|
|
|
|
## webservers:
|
|
|
|
## hosts:
|
|
|
|
## alpha.example.org:
|
|
|
|
## beta.example.org:
|
|
|
|
## 192.168.1.100:
|
|
|
|
## 192.168.1.110:
|
2016-04-07 22:22:36 +02:00
|
|
|
|
|
|
|
# Ex 3: You can create hosts using ranges and add children groups and vars to a group
|
2016-06-29 20:31:25 +02:00
|
|
|
# The child group can define anything you would normally add to a group
|
2016-04-07 22:22:36 +02:00
|
|
|
|
2017-03-08 20:51:38 +01:00
|
|
|
## testing:
|
|
|
|
## hosts:
|
|
|
|
## www[001:006].example.com:
|
|
|
|
## vars:
|
|
|
|
## testing1: value1
|
|
|
|
## children:
|
|
|
|
## webservers:
|
|
|
|
## hosts:
|
|
|
|
## beta.example.org:
|
|
|
|
|
|
|
|
# Ex 4: all vars
|
2017-06-12 08:55:19 +02:00
|
|
|
# keeping within 'all' group you can define common 'all' vars here with lowest precedence
|
2017-03-08 20:51:38 +01:00
|
|
|
|
2016-04-07 22:22:36 +02:00
|
|
|
## vars:
|
2017-03-08 20:51:38 +01:00
|
|
|
## commontoall: thisvar
|