小编Vij*_*jay的帖子

有没有办法验证 Ansible Inventory 文件中组的主机数量?

我的要求如下所示,我有一个 Ansible 库存文件,它根据下面显示的组件分为几组:

[all]

node1 
node2
node3
node4

[webapp]
node3
node4

[ui]
node1
Run Code Online (Sandbox Code Playgroud)

如果条件失败,那么有没有办法验证库存文件中组的主机数量,那么 playbook 不应运行?

我的条件是:ui组应该始终只有一个主机。

前任:

[ui]
node1  -- condition check pass proceed with playbook execution

[ui]
node1 
node2  -- condition fails should stop playbook execution with exception 
          with ui group cannot have more than one hosts
Run Code Online (Sandbox Code Playgroud)

ansible ansible-inventory

2
推荐指数
1
解决办法
1835
查看次数

标签 统计

ansible ×1

ansible-inventory ×1