# Register and print stdout\_lines output while running a loop \[code help\]

**URL:** <https://forum.ansible.com/t/register-and-print-stdout-lines-output-while-running-a-loop-code-help/27006>\
**Category:** Ansible Project\
**Created:** [March 15, 2018, 4:47pm UTC](https://forum.ansible.com/t/register-and-print-stdout-lines-output-while-running-a-loop-code-help/27006 "2018-03-15T16:47:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raj5](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Raj5](https://forum.ansible.com/u/Raj5)\
**Post date:** [March 15, 2018, 4:47pm UTC](https://forum.ansible.com/t/register-and-print-stdout-lines-output-while-running-a-loop-code-help/27006/1 "2018-03-15T16:47:40Z")

</div>

Hello,

I am currently working on a task as below

`

- name: Client Schema upgrade  
shell: source ~/.bash\_profile && sqlplus -S ‘{{ username }}/{{ password }}@{{ TNS\_NAME }}’ @“client.sql” {{ item }}  
with\_items: “{{ schema\_names.stdout\_lines }}”  
register: client\_schema  
args:  
chdir: roles/deploy/files/dbscripts/scripts/  
delegate\_to: localhost  
tags: client\_schema

- debug: var=client\_schema.stdout\_lines  
delegate\_to: localhost

`

I’ve used as above but getting variable undefined.

Later I changed my code to

`

- name: Client Schema upgrade  
shell: source ~/.bash\_profile && sqlplus -S ‘{{ username }}/{{ password }}@{{ TNS\_NAME }}’ @“client.sql” {{ item }}  
with\_items: “{{ schema\_names.stdout\_lines }}”  
register: client\_schema  
args:  
chdir: roles/deploy/files/dbscripts/scripts/  
delegate\_to: localhost  
tags: client\_schema

- name: Fail if return code is not 0  
fail:  
msg: “The command ({{ item.cmd }}) did not have a 0 return code”  
when: item.rc != 0  
with\_items: “{{ client\_schema.results }}”

`

This is printing the results of client\_schema however it’s printing sensitive information like passwords, I just need to print stdout\_lines. which contains SQL procedure execution results.

Can someone help me to just print stdout\_lines when running a loop?

Thanks and regards  
Raj
