Skip to content

Instantly share code, notes, and snippets.

@dekimsey
Created July 12, 2016 18:41
Show Gist options
  • Save dekimsey/2cc7844d3994e98bdb8b5410212d268b to your computer and use it in GitHub Desktop.
Save dekimsey/2cc7844d3994e98bdb8b5410212d268b to your computer and use it in GitHub Desktop.
with_items fails to flag module errors as failures
---
- hosts: localhost
connection: local
become: true
gather_facts: false
tasks:
- block:
- yum:
name: foobar
state: installed
rescue:
- name: Installing missing package dies OK
debug:
msg: 'The single missing package died correctly, status=failed'
- block:
- yum:
name: "ansible,foobar"
rescue:
- name: Installing multiple packages (csv) dies OK
debug:
msg: 'The csv version dies correctly, status=failed'
- block:
- yum:
name: "{{item}}"
state: installed
with_items:
- ansible
- foobar
rescue:
- name: Installing multiple packages (with_items) dies FAILED
debug:
msg: 'The with_items died and aborts run however status!=failed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment