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

时间:2017-11-29 09:41:23

标签: ansible ansible-inventory

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

[all]

node1 
node2
node3
node4

[webapp]
node3
node4

[ui]
node1

如果条件失败,那么有没有办法验证库存文件中组的主机数量,那么不应该运行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

0 个答案:

没有答案