Files
Matt DavisandGitHub 6272e9d6b6 Add INJECT_INVOCATION config (#86771) (#86865)
* 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)
2026-04-21 11:57:37 +00:00

30 lines
1.5 KiB
YAML

- hosts: testhost
gather_facts: no
tasks:
- name: Use a specially crafted module to see if things were imported correctly
test:
# Invocation usually is output with 3vs or more, our callback plugin displays it anyway
- name: Check no_log invocation results
shell: ANSIBLE_INJECT_INVOCATION=1 ansible-playbook -i {{ inventory_file }} module_utils_test_no_log.yml
delegate_to: localhost
environment:
ANSIBLE_CALLBACK_PLUGINS: callback
ANSIBLE_STDOUT_CALLBACK: pure_json
register: no_log_invocation
- set_fact:
no_log_invocation: '{{ no_log_invocation.stdout | trim | from_json }}'
- name: check no log values from fallback or default are masked
assert:
that:
- no_log_invocation.invocation.module_args.default_pass == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
- no_log_invocation.invocation.module_args.explicit_pass == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
- no_log_invocation.invocation.module_args.fallback_pass == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
- no_log_invocation.invocation.module_args.normal == 'plaintext'
- no_log_invocation.invocation.module_args.suboption.default_sub_pass == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
- no_log_invocation.invocation.module_args.suboption.explicit_sub_pass == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
- no_log_invocation.invocation.module_args.suboption.fallback_sub_pass == 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
- no_log_invocation.invocation.module_args.suboption.normal == 'plaintext'