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