嵌套的Yaml库存文件是否支持ansible? [英] is nested yaml inventory file for ansible supported?
问题描述
我正在尝试使用Yaml文件作为清单文件,如下所示:
- prod:
webserver:
hosts:
example1.com
db_servers:
hosts:
example2.com
example3.com
- stag:
webserver:
hosts:
example3.com
它似乎无法正常工作,而且我找不到有关Ansible docs arounf yaml广告资源文件的更多信息.是否支持上述内容?
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?
推荐答案
否,不支持此功能.您应该具有用于生产/测试的不同库存.
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:
在这种情况下,组test
是webserver
和db_servers
的父级.
In this case group test
is a parent of webserver
and db_servers
.
这篇关于嵌套的Yaml库存文件是否支持ansible?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!