1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
- name: integration/async/result_binary_producing_json.yml
gather_facts: true
hosts: test-targets
tasks:
- block:
- custom_binary_producing_json_Darwin:
async: 100
poll: 0
register: job_darwin
- set_fact: job={{job_darwin}}
when: ansible_system == "Darwin"
- block:
- custom_binary_producing_json_Linux:
async: 100
poll: 0
register: job_linux
- set_fact: job={{job_linux}}
when: ansible_system == "Linux"
- assert:
that: |
job.ansible_job_id and
(job.changed == True) and
(job.started == 1) and
(job.changed == True) and
(job.finished == 0)
fail_msg: |
job={{ job }}
- name: busy-poll up to 100000 times
async_status:
jid: "{{job.ansible_job_id}}"
register: result
until: result is finished
retries: 100000
delay: 0
- name: Slurp async busy-poll
slurp:
src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}"
register: result
#- debug: msg={{async_out}}
#vars:
#async_out: "{{result.content|b64decode|from_json}}"
- assert:
that:
- async_out.changed == True
- async_out.failed == False
- async_out.msg == "Hello, world."
- 'async_out.stderr == "binary_producing_json: oh noes\n"'
fail_msg: |
async_out={{ async_out }}
vars:
async_out: "{{result.content|b64decode|from_json}}"
tags:
- result_binary_producing_json
|