是否支持 ansible 的嵌套 yaml 清单文件? [英] is nested yaml inventory file for ansible supported?
问题描述
我正在尝试使用 yaml 文件作为清单文件,如下所示:<代码>- 产品:网络服务器:主持人:example1.com数据库服务器:主持人:example2.comexample3.com- 雄鹿:网络服务器:主持人:example3.com
它似乎不起作用,而且我在 ansible 文档 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
.
这篇关于是否支持 ansible 的嵌套 yaml 清单文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!