我的要求如下所示,我有一个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