Skip to content

Instantly share code, notes, and snippets.

@lancelakey
Created February 2, 2016 12:05
Show Gist options
  • Save lancelakey/02769ea7974f17de2634 to your computer and use it in GitHub Desktop.
Save lancelakey/02769ea7974f17de2634 to your computer and use it in GitHub Desktop.
Ansible always run and test afterwards
- name: Run some tests
hosts: all
tasks:
- block:
- name: block-1
command: /usr/bin/true
register: r1
- name: block-2
command: /usr/bin/true
register: r2
- name: block-3
command: /usr/bin/true
register: r3
ignore_errors: yes
- name: Test previous block
fail: msg="Previous block failed"
when: r1|failed or r2|failed or r3|failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment