is nested yaml inventory file for ansible supported?

对着背影说爱祢 提交于 2019-12-25 07:46:48

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/43139743/is-nested-yaml-inventory-file-for-ansible-supported

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!