Hi,
Instead of *stdout*, I would suggest using *stdout_lines*. For multiline output this is much nicer, e.g. - hosts: all tasks: - name: Run ls.sh and output "ls /" script: ls.sh register: out - debug: var=out.stdout_lines gives TASK: [debug var=out.stdout_lines] ******************************************** ok: [local] => { "var": { "out.stdout_lines": [ "total 61", "lrwxrwxrwx 1 root root 7 Feb 15 2015 bin -> usr/bin", "drwxr-xr-x 6 root root 1024 Aug 24 22:08 boot", "drwxr-xr-x 22 root root 3580 Sep 8 18:41 dev", [...] "drwxr-xr-x 9 root root 4096 Aug 25 19:14 usr", "drwxr-xr-x 13 root root 4096 Feb 25 2015 var" ] } } Regarding real-time output for debugging purposes, there is a closed bug reporthttps://github.com/ansible/ansible/issues/3887#issuecomment-54672569 discussing the reasons why this is not possible and will not be implemented. Thanks and regards, Liana melissa, Automation developer <https://mindmajix.com/ansible-training>. On Wednesday, April 3, 2019, at 7:52:32 PM UTC+5:30, Kunalsing Thakur wrote: > > playbook:- > task:- > - name: Deploying PCC-test > hosts: pulp > gather_facts: true > vars_files: > - /etc/ansible/inventories/group_vars/common.yaml > vars: > - rpmsearch: true > - rpmname: > - mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch > serial: 1 > any_errors_fatal: true > roles: > - role: mobi_ansible_role_pulp > > Pulp.yaml:- > > --- > - name: Logging into pulp > shell: pulp-admin login -u admin -p admin > - name: searching the rpm into pulp repo > shell: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match > 'filename={{ item }}' > with_items: "{{ rpmname | default([]) }}" > register: pulp > when: rpmsearch is defined > - debug: > var: pulp.results.stdout > > > Playbook output:- > PLAYBOOK: pulp.yaml > ********************************************************************************************** > 1 plays in pulp.yaml > [WARNING]: Found variable using reserved name: remote_user > > > PLAY [Deploying PCC-test] > **************************************************************************************** > > TASK [Gathering Facts] > ******************************************************************************************* > task path: /etc/ansible/playbooks/paytv/pulp.yaml:2 > Wednesday 03 April 2019 14:18:45 +0000 (0:00:00.136) 0:00:00.136 > ******* > ok: [node] > META: ran handlers > > TASK [mobi_ansible_role_pulp : include_tasks] > ******************************************************************** > task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12 > Wednesday 03 April 2019 14:18:49 +0000 (0:00:03.725) 0:00:03.862 > ******* > included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for > inplp01p2.infra.smf1.mobitv > > TASK [mobi_ansible_role_pulp : Logging into pulp] > **************************************************************** > task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2 > Wednesday 03 April 2019 14:18:49 +0000 (0:00:00.409) 0:00:04.271 > ******* > changed: [node] => changed=true > cmd: pulp-admin login -u admin -p admin > delta: '0:00:01.010085' > end: '2019-04-03 14:18:51.477441' > rc: 0 > start: '2019-04-03 14:18:50.467356' > stderr: '' > stderr_lines: [] > stdout: |- > [0m[92mSuccessfully logged in. Session certificate will expire at Apr > 10 14:18:51 2019 > GMT.[0m > stdout_lines: <omitted> > > TASK [mobi_ansible_role_pulp : searching the rpm into pulp repo] > ************************************************* > task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4 > Wednesday 03 April 2019 14:18:51 +0000 (0:00:01.985) 0:00:06.256 > ******* > changed: [node] => > (item=mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch) => changed=true > cmd: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match > 'filename=mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch' > delta: '0:00:01.417179' > end: '2019-04-03 14:18:53.720125' > item: mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch > rc: 0 > start: '2019-04-03 14:18:52.302946' > stderr: '' > stderr_lines: [] > stdout: |- > [0mArch: noarch > Buildhost: 3c33318f8330 > Checksum: > 33816f5a2680403526591148da282e680655ad354fe23f80cc100824dcc1b4f1 > Checksumtype: sha256 > Description: Mobi Auth Manager > Epoch: 0 > Filename: mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch.rpm > License: MobiTV, Inc. > Name: mobi-auth-manager > Provides: mobi-auth-manager = 5.42.0-201903291228.ed4d6a0-0, > osgi(ch.qos.logback.classic) = 1.1.2-0, > osgi(ch.qos.logback.core) > = 1.1.2-0, osgi(com.google.guava) = 14.0.1-0, > osgi(com.sun.jersey.client) = 1.17.0-0, > osgi(com.sun.jersey.contribs.jersey-apache-client) = > 1.17.0-0, > osgi(com.sun.jersey.contribs.jersey-apache-client4) = > 1.17.1-0, > osgi(com.sun.jersey.contribs.jersey-spring) = 1.17.0-0, > osgi(com.sun.jersey.core) = 1.17.0-0, > osgi(com.sun.jersey.jersey-server) = 1.17.0-0, > osgi(com.sun.jersey.json) = 1.17.0-0, > osgi(com.sun.jersey.servlet) > = 1.17.0-0, osgi(com.sun.xml.bind) = 2.2.3-0, > osgi(curator-client) > = 2.2.0-0, osgi(curator-framework) = 2.2.0-0, > osgi(curator-recipes) = 2.2.0-0, > osgi(curator-x-discovery) = > 2.2.0-0, osgi(jackson-core-asl) = 1.9.12-0, > osgi(jackson-jaxrs) = > 1.9.9-0, osgi(jackson-mapper-asl) = 1.9.9-0, > osgi(jackson-xc) = > 1.9.9-0, osgi(javax.ws.rs.jsr311-api) = 1.1.1-0, > osgi(jaxb-api) = > 2.2.2-0, osgi(jcl.over.slf4j) = 1.7.7-0, > osgi(log4j.over.slf4j) = > 1.7.7-0, osgi(org.apache.commons.codec) = 1.10.0-0, > osgi(org.apache.commons.collections) = 3.2.1-0, > osgi(org.apache.commons.io) = 2.4.0-0, > osgi(org.apache.commons.lang) = 2.6-0, > osgi(org.apache.commons.net) = 2.2-0, > osgi(org.apache.hadoop.zookeeper) = 3.4.5-0, > osgi(org.codehaus.jettison.jettison) = 1.1-0, > osgi(org.jboss.netty) = 3.2.3-0, > osgi(org.mortbay.jetty.servlet-api-2.5) = 2.5-0, > osgi(slf4j.api) = > 1.7.7-0, osgi(stax2-api) = 3.1.4-0, > osgi(woodstox-core-asl) = > 4.4.1-0 > Release: 201903291228.ed4d6a0 > Requires: mobi-tomcat-config-8080 >= 8.0.17-0 > Version: 5.42.0 > stdout_lines: <omitted> > > TASK [mobi_ansible_role_pulp : debug] > **************************************************************************** > task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:9 > Wednesday 03 April 2019 14:18:53 +0000 (0:00:02.239) 0:00:08.496 > ******* > ok: [node] => > pulp.results.stdout: 'VARIABLE IS NOT DEFINED!: ''list object'' has no > attribute ''stdout''' > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/358c079d-dbed-4c15-a3c9-ce31d8cfd5b0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.