如果一场比赛失败,如何停止剧本

Dav*_*vid 6 ansible ansible-playbook

我有以下剧本有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:
    - ...
Run Code Online (Sandbox Code Playgroud)

小智 9

如果有任何错误,您可以使用any_errors_fatal停止播放.


- name: create the EC2 instances
  hosts: localhost
  connection: local
  any_errors_fatal: true
  tasks:
   - ...
Run Code Online (Sandbox Code Playgroud)

参考链接