|
|
|
|
|
|
|
- name: integration/async/result_binary_producing_json.yml
|
|
|
|
gather_facts: true
|
|
|
|
hosts: test-targets
|
|
|
|
any_errors_fatal: true
|
|
|
|
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.finished
|
|
|
|
retries: 100000
|
|
|
|
delay: 0
|
|
|
|
|
|
|
|
- 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
|