Skip to content

Commit 8b39026

Browse files
committed
Added task and changed output format
Signed-off-by: Ivan Moreno <[email protected]>
1 parent 1e47e42 commit 8b39026

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

Diff for: zos_concepts/templates/copy_template/ansible.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
[defaults]
1313
forks = 25
1414
roles_path = ../../../roles:.
15+
stdout_callback = unixy
1516

1617
[ssh_connection]
1718
pipelining = True

Diff for: zos_concepts/templates/copy_template/zos_copy_template.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
- 5
6060
- 6
6161

62-
# disable trim_blocks and see difference
6362
tasks:
6463
- name: Get available z/OS facts to use with the templates.
6564
ibm.ibm_zos_core.zos_gather_facts:
@@ -72,13 +71,8 @@
7271
dest: "{{ json_path }}"
7372
use_template: true
7473

75-
- name: Get the contents of {{ json_path }}
74+
- name: See the contents of {{ json_path }}
7675
ansible.builtin.command: "cat {{ json_path }}"
77-
register: output
78-
79-
- name: See the contents of the rendered template.
80-
ansible.builtin.debug:
81-
msg: "{{ output.stdout }}"
8276

8377
- name: Erase remote files.
8478
ansible.builtin.file:
@@ -100,13 +94,8 @@
10094
dest: "{{ default_dataset_name }}"
10195
use_template: true
10296

103-
- name: Get the contents of {{ default_dataset_name }}.
97+
- name: See the contents of {{ default_dataset_name }}.
10498
ansible.builtin.command: "cat \"//'{{ default_dataset_name }}'\""
105-
register: output
106-
107-
- name: See the contents of the rendered template.
108-
ansible.builtin.debug:
109-
msg: "{{ output.stdout }}"
11099

111100
# Dataset using custom markers.
112101
- name: Create a temporary dataset name.
@@ -126,13 +115,24 @@
126115
variable_start_string: "(("
127116
variable_end_string: "))"
128117

129-
- name: Get the contents of {{ custom_dataset_name }}.
118+
- name: See the contents of {{ custom_dataset_name }}.
130119
ansible.builtin.command: "cat \"//'{{ custom_dataset_name }}'\""
131-
register: output
132120

133-
- name: See the contents of the rendered template.
134-
ansible.builtin.debug:
135-
msg: "{{ output.stdout }}"
121+
# Rendering records.j2 again, but changing how whitespace is handled.
122+
# This task will create empty records due to not trimming newlines
123+
# after rendering blocks.
124+
- name: Copy a template to a dataset without trimming whitespace.
125+
zos_copy:
126+
src: ./files/records.j2
127+
dest: "{{ default_dataset_name }}"
128+
use_template: true
129+
force: true
130+
template_parameters:
131+
trim_blocks: false
132+
keep_trailing_newline: true
133+
134+
- name: See the contents of {{ default_dataset_name }}. Note the blank lines.
135+
ansible.builtin.command: "cat \"//'{{ default_dataset_name }}'\""
136136

137137
- name: Erase datasets.
138138
ibm.ibm_zos_core.zos_data_set:

0 commit comments

Comments
 (0)