I have the result of a query from ansible and I tried to use the result as 
a variable

My playbook is like this

- name: Query
  oracle_sql:
    username: "{{ user }}"
    password: "{{ password }}"
    service_name: "{{ service_name }}"
    sql: "select smth  from table where smth like 'OK_%'"
  register: smth"

the result is formatted as below

"msg": [
    [
        "SMTH"
    ]]

no stdout, no stderr

after this I want to use my variable

- name: echo
  shell: echo {{ smth.msg[0] }} > /tmp/test

and the outuput is like this:

[uSMTH]

How to remove brackets and 'u' , I know it s a list but I can t get rid of 
this

I tried to convert in yaml or json format no luck , this last add some 
retrun carriage with

| to_yaml | to_json|to_nice_yaml| to_nice_json

Any advice ?

-- 
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/737ba56a-896f-4506-b297-7d84458594b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to