Re: [ansible-project] How to get clean output ?

2020-02-12 Thread Anand Solomon
Thank you so much Vlado. It works fine. On Wednesday, February 12, 2020 at 1:49:13 PM UTC-5, Vladimir Botka wrote: > > On Wed, 12 Feb 2020 08:51:12 -0800 (PST) > Anand Solomon > wrote: > > > - name: Generate Revoke Statement > > local_action: > > copy dest=

Re: [ansible-project] How to get clean output ?

2020-02-12 Thread Vladimir Botka
On Wed, 12 Feb 2020 08:51:12 -0800 (PST) Anand Solomon wrote: > - name: Generate Revoke Statement > local_action: > copy dest= /home/ansible/query.sql > content= {% for line in query_result.msg|flatten %} {{ line }} {% > endfor %} > connection: local > > I get

Re: [ansible-project] How to get clean output ?

2020-02-12 Thread Anand Solomon
Thanks Vlado, We don't want to maintain separate files. Here is my - name: Generate Revoke Statement local_action: copy dest= /home/ansible/query.sql content= {% for line in query_result.msg|flatten %} {{ line }} {% endfor %} connection: local I get -->

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Vladimir Botka
On Tue, 11 Feb 2020 14:59:04 -0800 (PST) Anand Solomon wrote: > Instead of maintaining another template file. Can I embed the content in > the playbook itself ? Sure you can. Put it into the "content". For example - local_action: copy dest=/scratch/tmp/revoke.sql

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Instead of maintaining another template file. Can I embed the content in the playbook itself ? On Tuesday, February 11, 2020 at 5:57:09 PM UTC-5, Anand Solomon wrote: > > Thank you so much Vlado. This works fine. > > On Tuesday, February 11, 2020 at 5:40:05 PM UTC-5, Vladimir Botka wrote: >> >>

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Thank you so much Vlado. This works fine. On Tuesday, February 11, 2020 at 5:40:05 PM UTC-5, Vladimir Botka wrote: > > On Tue, 11 Feb 2020 14:02:45 -0800 (PST) > Anand Solomon > wrote: > > > I need to get this > > Revoke EXECUTE on UTL_FILE from TESTACC1; Revoke EXECUTE on UTL_FILE > from >

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Vladimir Botka
On Tue, 11 Feb 2020 14:02:45 -0800 (PST) Anand Solomon wrote: > I need to get this > Revoke EXECUTE on UTL_FILE from TESTACC1; Revoke EXECUTE on UTL_FILE from > TESTACC2; To keep the element of the list in one line change the template. For example $ cat revoke.sql.j2 {% for line in

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Vladimir Botka
On Tue, 11 Feb 2020 14:02:45 -0800 (PST) Anand Solomon wrote: > "msg": { > "ansible_facts": { > "discovered_interpreter_python": "/usr/bin/python" > }, > "changed": false, > "failed": false, > "msg": [ > [ >

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Thanks Hugo for helping me. Basically I am running a sql command that runs a sql query which gives the below results. (this is a debug out) "msg": { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false,

Re: [ansible-project] How to get clean output ?

2020-02-11 Thread Hugo Gonzalez
Without knowing anything about how you got those values, it would be {{ query_result.msg | join(' ') }} Hugo G. If I do     - local_action:         copy content={{query_result.msg}} dest=/home/ansible/Playbooks/{{sname}}/sql/revoke.sql I am getting [["Revoke

[ansible-project] How to get clean output ?

2020-02-11 Thread Anand Solomon
Hi, How will I get only the sql statement from the json output ? I am registering this as " register: query_result" Here is my json output "msg": { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false,