1- ---
2- - name : Playbook with huge output
3- hosts : localhost
4- gather_facts : yes
5-
6- vars :
7- dummy_file_path : /tmp/ansible_dummy_file.txt
8- dummy_lines : 100
9-
10- tasks :
11-
12- - name : Print host info
13- debug :
14- msg : " Running on {{ inventory_hostname }}"
15-
16- - name : Generate large output using debug
17- debug :
18- msg : " {{ item }}"
19- loop : " {{ range(1, 51)|list }}"
20-
21- - name : Create dummy file
22- copy :
23- dest : " {{ dummy_file_path }}"
24- content : " "
25- force : yes
26-
27- - name : Add 100 lines to dummy file
28- lineinfile :
29- path : " {{ dummy_file_path }}"
30- line : " This is line {{ item }}"
31- create : yes
32- loop : " {{ range(1, dummy_lines + 1)|list }}"
33-
34- - name : Stat dummy file
35- stat :
36- path : " {{ dummy_file_path }}"
37- register : dummy_stat
38-
39- - name : Show file size and checksum
40- debug :
41- var : dummy_stat.stat
42-
43- - name : Repeat shell commands
44- shell : ' echo "Loop index: {{ item }}"; date'
45- register : loop_shell
46- loop : " {{ range(1, 30)|list }}"
47-
48- - name : Show each shell command output
49- debug :
50- msg : " {{ item.stdout }}"
51- loop : " {{ loop_shell.results }}"
52-
53- - name : Create many empty files
54- file :
55- path : " /tmp/dummy_file_{{ item }}.txt"
56- state : touch
57- loop : " {{ range(1, 50)|list }}"
58-
59- - name : List all /tmp files
60- shell : ls -lh /tmp | grep dummy_file
61- register : tmp_files
62-
63- - name : Print file list
64- debug :
65- msg : " {{ tmp_files.stdout_lines }}"
66-
67- - name : Gather detailed facts
68- setup :
69-
70- - name : Print OS info
71- debug :
72- var : ansible_distribution
73-
74- - name : Print CPU count
75- debug :
76- var : ansible_processor_cores
1+ - name : Print host info
2+ debug :
3+ msg : " Running on {{ inventory_hostname }}"
4+
5+ - name : Generate large output using debug
6+ debug :
7+ msg : " {{ item }}"
8+ loop : " {{ range(1, 51)|list }}"
9+
10+ - name : Create dummy file
11+ copy :
12+ dest : " {{ dummy_file_path }}"
13+ content : " "
14+ force : yes
15+
16+ - name : Add 100 lines to dummy file
17+ lineinfile :
18+ path : " {{ dummy_file_path }}"
19+ line : " This is line {{ item }}"
20+ create : yes
21+ loop : " {{ range(1, dummy_lines + 1)|list }}"
22+
23+ - name : Stat dummy file
24+ stat :
25+ path : " {{ dummy_file_path }}"
26+ register : dummy_stat
27+
28+ - name : Show file size and checksum
29+ debug :
30+ var : dummy_stat.stat
31+
32+ - name : Repeat shell commands
33+ shell : ' echo "Loop index: {{ item }}"; date'
34+ register : loop_shell
35+ loop : " {{ range(1, 30)|list }}"
36+
37+ - name : Show each shell command output
38+ debug :
39+ msg : " {{ item.stdout }}"
40+ loop : " {{ loop_shell.results }}"
41+
42+ - name : Create many empty files
43+ file :
44+ path : " /tmp/dummy_file_{{ item }}.txt"
45+ state : touch
46+ loop : " {{ range(1, 50)|list }}"
47+
48+ - name : List all /tmp files
49+ shell : ls -lh /tmp | grep dummy_file
50+ register : tmp_files
51+
52+ - name : Print file list
53+ debug :
54+ msg : " {{ tmp_files.stdout_lines }}"
55+
56+ - name : Gather detailed facts
57+ setup :
58+
59+ - name : Print OS info
60+ debug :
61+ var : ansible_distribution
62+
63+ - name : Print CPU count
64+ debug :
65+ var : ansible_processor_cores
0 commit comments