Skip to content

Instantly share code, notes, and snippets.

@rvanbutselaar
Created March 26, 2019 07:53
Show Gist options
  • Save rvanbutselaar/f4ccdb76bb44e8cb4776a1943e3ff419 to your computer and use it in GitHub Desktop.
Save rvanbutselaar/f4ccdb76bb44e8cb4776a1943e3ff419 to your computer and use it in GitHub Desktop.
- hosts: "{{ src_server }}"
gather_facts: false
any_errors_fatal: true
- block
rescue:
- set_fact:
failed_play: true
delegate_to: "{{ item }}"
delegate_facts: yes
with_items:
- "{{ src_server }}"
- "{{ dst_server }}"
tags: always
- hosts: "{{ dst_server }}"
gather_facts: false
any_errors_fatal: true
tasks:
- block:
- fail:
msg: "Fail when previous play(s) also failed"
when: failed_play
tags: always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment