Something like this should work:

[wani@linux tmp ]$ cat a.yaml
- hosts: localhost

  tasks:
    - command: 'echo {\"key\": \"value\"}'
      register: my_output

    - debug:
        msg: "{{ my_output.stdout | from_json }}"


On, run, it will show:

TASK [debug] 
********************************************************************************************************************************************************************************
task path: /tmp/a.yaml:7
ok: [localhost] => {
    "changed": false,
    "msg": {
        "key": "value"
    }
}

On Sat, Feb 11, 2017 at 8:19 PM, Alok Ranjan <[email protected]> wrote:
> Dear All,
>
> Can anyone please let me know how to use a register variable in JSON.
>
> Where JSON is passed as an argument to a command using command module.
>
> Any help or assistance would be highly appreciated.
>
> Thanks,
> Alok
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/42641283-4ea2-43fe-941a-6c8bf4e548af%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Nehal J Wani

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG6NSrnRyL48M_C3JGLGBbNV-S_NSDv_EoEktO2vyJzWat_iDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to