- name: integration/runner/custom_binary_producing_junk.yml
  hosts: test-targets
  gather_facts: true
  tasks:
    - block:
      - custom_binary_producing_junk_Darwin:
          foo: true
        with_sequence: start=1 end={{end|default(1)}}
        ignore_errors: true
        register: out_darwin
      - set_fact: out={{out_darwin}}
      when: ansible_system == "Darwin"

    - block:
      - custom_binary_producing_junk_Linux:
          foo: true
        with_sequence: start=1 end={{end|default(1)}}
        ignore_errors: true
        register: out_linux
      - set_fact: out={{out_linux}}
      when: ansible_system == "Linux"
  tags:
    - custom_binary_producing_junk


- hosts: test-targets
  tasks:
    - assert:
        that:
        - out.failed
        - out.results[0].failed
        - out.results[0].msg.startswith('MODULE FAILURE')
          or out.results[0].msg.startswith('Module result deserialization failed')
        - out.results[0].rc == 0
        fail_msg: |
          out={{ out }}
  tags:
    - custom_binary_producing_junk
