You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/ansible/integration/async/result_shell_echo_hi.yml

54 lines
1.9 KiB
YAML

- name: integration/async/result_shell_echo_hi.yml
gather_facts: true
hosts: test-targets
tasks:
- shell: echo hi; echo there >&2
async: 100
poll: 0
register: job
- shell: sleep 1
- slurp:
src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}"
register: result
#- debug: msg="{{result.content|b64decode|from_json}}"
- assert:
that:
- async_out.changed == True
- async_out.cmd == "echo hi; echo there >&2"
- 'async_out.delta.startswith("0:00:")'
- async_out.end.startswith("20")
- async_out.invocation.module_args._raw_params == "echo hi; echo there >&2"
- async_out.invocation.module_args._uses_shell == True
- async_out.invocation.module_args.chdir == None
- async_out.invocation.module_args.creates == None
- async_out.invocation.module_args.executable == None
- async_out.invocation.module_args.removes == None
# In Ansible 4 (ansible-core 2.11) the warn parameter is deprecated and defaults to false.
# It's scheduled for removal in ansible-core 2.13.
- (ansible_version.full is version("2.11", "<", strict=True) and async_out.invocation.module_args.warn == True)
or (ansible_version.full is version("2.11", ">=", strict=True) and async_out.invocation.module_args.warn == False)
- async_out.rc == 0
- async_out.start.startswith("20")
- async_out.stderr == "there"
- async_out.stdout == "hi"
fail_msg: async_out={{async_out}}
vars:
async_out: "{{result.content|b64decode|from_json}}"
- assert:
that:
- async_out.invocation.module_args.stdin == None
fail_msg: async_out={{async_out}}
when:
- ansible_version.full is version('2.4', '>=', strict=True)
vars:
async_out: "{{result.content|b64decode|from_json}}"
tags:
- result_shell_echo_hi