2
我有以下劇本3次。當其中一場比賽失敗時,接下來的比賽仍然執行。我想這是因爲我用不同的主機目標來運行這些遊戲。如果一個遊戲失敗,如何停止劇本
我想避免這種情況,並在劇本失敗時讓劇本停止,這有可能嗎?
---
- name: create the EC2 instances
hosts: localhost
any_errors_fatal: yes
connection: local
tasks:
- ...
- name: configure instances
hosts: appserver
any_errors_fatal: yes
gather_facts: true
tasks:
- ...
- name: Add to load balancer
hosts: localhost
any_errors_fatal: yes
vars:
component: travelmatrix
tasks:
- ...
這不起作用,因爲'any_errors_fatal'標記只在劇中的主機爲失敗,但接下來的比賽適用於不同的主機(它實際上適用於本地主機)。我已經更新了問題中的劇本,表明已經設置了「any_error_fatals」。 – David
對不起,我沒有正確測試。你的回答是對的。 SO目前不讓我刪除-1,但我會接受答案。 – David