Hello,

I need to build Ansible inventory files, but somehow got stuck. Typically 
for a service, there is development, staging and production. Initially, I 
thought I can create 3 inventory files with those names. Later I feel it 
may not be the case. As I look at this Ansible document: 
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#example-group-by-function,
 
it actually lists (3) grouping methods, by environment, by functions, and 
by locations. Can I have a inventory file that is both grouped by 
environment and by functions? It seems not possible. For example, consider 
the following inventory file named as myservices:

[development]
testwebserver1
testwebserver2
testloadbalancer1

[production]
webserver1
webserver2
loadbalancer1

[myservices:children]
development
production

If the inventory file is development or production, that means it would 
include all other services and it will become a big inventory file, and 
playbook will be hard to write to manage all kinds services, for example, 
development inventory file:

[myservice1]
testwebserver1
testwebserver2

[myservice2]
testwebserver3
testwebserver4

[load_balancers]
loadbalancer1

[development:children]
myservice1
myservice2
load_balancers

Is it a good practice to break down one big inventory file containing a lot 
of services into inventory files just for that service like the first one?

Thank you,

- Xinhuan Zheng

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1517c5c1-31e0-4eaa-b793-1d7fd3846cd3%40googlegroups.com.

Reply via email to