mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
diy callback: add test for on_any_msg (#10550)
Add test for on_any_msg.
(cherry picked from commit ac4aca2004)
This commit is contained in:
@@ -460,3 +460,63 @@
|
|||||||
"PLAY RECAP *********************************************************************",
|
"PLAY RECAP *********************************************************************",
|
||||||
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
||||||
]
|
]
|
||||||
|
|
||||||
|
- name: Set on_any_msg
|
||||||
|
environment:
|
||||||
|
ANSIBLE_NOCOLOR: 'true'
|
||||||
|
ANSIBLE_FORCE_COLOR: 'false'
|
||||||
|
ANSIBLE_STDOUT_CALLBACK: community.general.diy
|
||||||
|
ANSIBLE_CALLBACK_DIY_ON_ANY_MSG: foo
|
||||||
|
playbook: !unsafe |
|
||||||
|
- hosts: testhost
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: A loop
|
||||||
|
debug:
|
||||||
|
msg: "{{ item }}"
|
||||||
|
loop:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
- name: Sample task name
|
||||||
|
debug:
|
||||||
|
msg: sample debug msg
|
||||||
|
- name: Skipped task
|
||||||
|
command: ls /
|
||||||
|
when: false
|
||||||
|
expected_output:
|
||||||
|
- "foo"
|
||||||
|
- ""
|
||||||
|
- "PLAY [testhost] ****************************************************************"
|
||||||
|
- "foo"
|
||||||
|
- ""
|
||||||
|
- "TASK [A loop] ******************************************************************"
|
||||||
|
- "foo"
|
||||||
|
- "foo"
|
||||||
|
- "ok: [testhost] => (item=1) => {"
|
||||||
|
- " \"msg\": 1"
|
||||||
|
- "}"
|
||||||
|
- "foo"
|
||||||
|
- "ok: [testhost] => (item=2) => {"
|
||||||
|
- " \"msg\": 2"
|
||||||
|
- "}"
|
||||||
|
- "foo"
|
||||||
|
- "foo"
|
||||||
|
- ""
|
||||||
|
- "TASK [Sample task name] ********************************************************"
|
||||||
|
- "foo"
|
||||||
|
- "foo"
|
||||||
|
- "ok: [testhost] => {"
|
||||||
|
- " \"msg\": \"sample debug msg\""
|
||||||
|
- "}"
|
||||||
|
- "foo"
|
||||||
|
- ""
|
||||||
|
- "TASK [Skipped task] ************************************************************"
|
||||||
|
- "foo"
|
||||||
|
- "foo"
|
||||||
|
- "skipping: [testhost]"
|
||||||
|
- "foo"
|
||||||
|
- ""
|
||||||
|
- "PLAY RECAP *********************************************************************"
|
||||||
|
- "testhost : ok=2 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 "
|
||||||
|
- ""
|
||||||
|
- "foo"
|
||||||
|
|||||||
Reference in New Issue
Block a user