Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/callback_tasks_only/tasks/main.yml

raw
1 ---
2 ####################################################################
3 # WARNING: These are designed specifically for Ansible tests #
4 # and should not be used as examples of how to write Ansible roles #
5 ####################################################################
6
7 # Copyright (c) Ansible Project
8 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
9 # SPDX-License-Identifier: GPL-3.0-or-later
10
11 - block:
12 - name: Create temporary file
13 tempfile:
14 register: tempfile
15
16 - name: Run tests
17 include_role:
18 name: callback
19 vars:
20 tests:
21 - name: Simple test
22 environment:
23 ANSIBLE_NOCOLOR: 'true'
24 ANSIBLE_FORCE_COLOR: 'false'
25 ANSIBLE_PYTHON_INTERPRETER: "{{ ansible_python_interpreter }}"
26 ANSIBLE_STDOUT_CALLBACK: community.general.tasks_only
27 playbook: |
28 - hosts: testhost
29 gather_facts: true
30 tasks:
31 - name: Create file
32 copy:
33 dest: "{{ tempfile.path }}"
34 content: |
35 Foo bar
36
37 - name: Modify file
38 copy:
39 dest: "{{ tempfile.path }}"
40 content: |
41 Foo bar
42 Bar baz bam!
43 expected_output:
44 - ""
45 - "TASK [Gathering Facts] *********************************************************"
46 - "ok: [testhost]"
47 - ""
48 - "TASK [Create file] *************************************************************"
49 - "changed: [testhost]"
50 - ""
51 - "TASK [Modify file] *************************************************************"
52 - "changed: [testhost]"
53 - name: Different column width
54 environment:
55 ANSIBLE_NOCOLOR: 'true'
56 ANSIBLE_FORCE_COLOR: 'false'
57 ANSIBLE_PYTHON_INTERPRETER: "{{ ansible_python_interpreter }}"
58 ANSIBLE_STDOUT_CALLBACK: community.general.tasks_only
59 ANSIBLE_COLLECTIONS_TASKS_ONLY_NUMBER_OF_COLUMNS: 40
60 playbook: |
61 - hosts: testhost
62 gather_facts: false
63 tasks:
64 - name: A task
65 debug:
66 msg: Test.
67 expected_output:
68 - ""
69 - "TASK [A task] ***************************"
70 - "ok: [testhost] => {"
71 - ' "msg": "Test."'
72 - "}"
73
74
75 always:
76 - name: Clean up temp file
77 file:
78 path: "{{ tempfile.path }}"
79 state: absent