play:
- set_fact:
irules: "{{ rule | json_query('[*].definition') }}"
- debug:
msg: "{{ irules }}"
output:
"msg": [
"when HTTP_REQUEST {\n switch -glob [HTTP::uri] {\n \"*HAC*\" { pool char.hr.cal.ed.ABC.pool }\n \n }\n}"
]
}
I'm expecting output to be in below format.
Expected output:
"when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"*HAC*" { pool char.hr.cal.ed.ABC.pool }
}
I have tried parsing "from_json" to the above play and ended up with the error:
"({{ rule | json_query('[*].definition') | from_json }}): the JSON object must be str, bytes or ``bytearray, not 'list'"}"
is there a way to convert list to string in ansibe? if not, any other suggestions would be appreciated to achieve "Expected output"`