is nested yaml inventory file for ansible supporte

2019-08-22 21:33发布

I'm trying to use a yaml file as inventory file which looks like below: - prod: webserver: hosts: example1.com db_servers: hosts: example2.com example3.com - stag: webserver: hosts: example3.com
It doesn't seem to work, and I couldn't find much info on ansible docs arounf yaml inventory file. Is the above supported?

标签: ansible
1条回答
我想做一个坏孩纸
2楼-- · 2019-08-22 22:03

No, this is not supported. You are supposed to have different inventories for production/testing.

You can only define single dependency tree like this:

webserver:
  hosts:
    example1:
db_servers:
  hosts:
    example2:
    example3:
test:
  children:
    webserver:
    db_servers:

In this case group test is a parent of webserver and db_servers.

查看更多
登录 后发表回答