mirror of
https://github.com/ansible/ansible.git
synced 2026-07-29 16:35:20 +02:00
* Add `INJECT_INVOCATION` config, misc invocation cleanup
* clean up copy action invocation injection
* add basic test coverage
* unbork templated config, misc test cleanup
* force invocation output in roles test
(cherry picked from commit 0df3d4abc5)
45 lines
1.4 KiB
YAML
45 lines
1.4 KiB
YAML
- hosts: localhost
|
|
gather_facts: no
|
|
tasks:
|
|
- name: test ping with default invocation disabled
|
|
ping:
|
|
data: blar
|
|
failed_when: _task.result.invocation is defined
|
|
|
|
- name: test ping with invocation enabled
|
|
vars:
|
|
ansible_inject_invocation: true
|
|
ping:
|
|
data: blar
|
|
failed_when: _task.result.invocation != dict(module_args=dict(data="blar"))
|
|
|
|
- name: test looped ping with default invocation disabled
|
|
ping:
|
|
data: blar {{ item }}
|
|
loop: [1, 2]
|
|
failed_when: _task.result.invocation is defined
|
|
|
|
- name: test looped ping with invocation enabled
|
|
vars:
|
|
ansible_inject_invocation: true
|
|
ping:
|
|
data: blar {{ item }}
|
|
loop: [1, 2]
|
|
failed_when: _task.result.invocation != dict(module_args=dict(data="blar " ~ item))
|
|
register: looped_ping
|
|
|
|
- assert:
|
|
that:
|
|
- looped_ping.results[0].invocation.module_args == dict(data="blar 1")
|
|
- looped_ping.results[1].invocation.module_args == dict(data="blar 2")
|
|
|
|
- name: test custom invocation module with invocation disabled
|
|
direct_invocation:
|
|
failed_when: _task.result.invocation is defined
|
|
|
|
- name: test custom invocation module with invocation enabled
|
|
vars:
|
|
ansible_inject_invocation: true
|
|
direct_invocation:
|
|
failed_when: _task.result.invocation != dict(manually_generated=true)
|