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