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,
“failed”: false,
“msg”: [
[
“Revoke EXECUTE on UTL_FILE from TESTACC1;”
],
[
“Revoke EXECUTE on UTL_FILE from TESTACC2;”
]
]
}
}
What I need to do is to generate another sql statement using this json output. When I run your command, it gives me
[u’Revoke EXECUTE on UTL_FILE from TESTACC1;‘][u’Revoke EXECUTE on UTL_FILE from TESTACC2;’]
Is there a filter or something we can use to get a cleaner output ?
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 → localhost]: FAILED! => {“changed”: false, “msg”: “dest is required”}