well it does return content already, all the stdout and such.

I think what you are saying is that have a flag that if the output of the
command is already JSON and you requested this behavior, return the JSON
datastructure in an element called "json"?

I'm somewhat open to it, but also think that because it's possible to do
the "from_json" stuff with set fact, we have a bit of a solution, and it
*might* be used in such a minority set of use cases skimming over the
option for most might cause greater confusion.
I don't know.

To be clear, I'm suggesting this:

- set_fact:
    foo: "{{ x | from_json }}"

Which I believe will keep data typed-ness if you use that form and not
"foo=" on one line.

Would need to check.




On Mon, Jul 14, 2014 at 3:15 PM, Michael Peters <[email protected]>
wrote:

> Would it be possible to have an extra option to command to so that it
> can work similar to the uri module's "return_content" option? That way
> results that are registered would be the same except for an extra json
> key with the structured data. Not sure what to call it as
> "return_content" isn't particularly descriptive.
>
> On Mon, Jul 14, 2014 at 3:08 PM, Michael DeHaan <[email protected]>
> wrote:
> > callback plugins exist in ansible for this purpose and there is the
> '--tree'
> > flag to ad-hoc /usr/bin/ansible mode.
> >
> > However, we're not really trying to be a system that emits arbitrary
> JSON as
> > many playbooks will include results for multiple systems and this would
> get
> > very very large and unwieldy.
> >
> >
> >
> >
> > On Mon, Jul 14, 2014 at 11:37 AM, Stuart Reynolds
> > <[email protected]> wrote:
> >>
> >> Re:(1) I've found that I can do this:
> >> - hosts: localhost
> >> - name: Describe instances
> >>   hosts: localhost
> >>   gather_facts: false # Prevents immediately logging in to hosts
> >>   tasks:
> >>   - command: aws ec2 describe-instances
> >>     register: result
> >>   - debug: var=result.stdout|from_json
> >> However, really what I want to do is:
> >>
> >> - hosts: localhost
> >> - name: Describe instance
> >>   hosts: localhost
> >>   gather_facts: false # Prevents immediately logging in to host
> >>   tasks:
> >>   - command: aws ec2 describe-instances
> >>     register: x=from_json(result.stdout)
> >>  - debug: var=x
> >>
> >> Possible?
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> 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/448b7e2e-ebec-4b1e-9100-61bc8fd060bd%40googlegroups.com
> .
> >>
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > 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/CA%2BnsWgzz8-7smB8CZWv7HtCFzk16CFq9vavcF-3vZ1EHMurepA%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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/CAJQqANeKhy5aNqjobbeQJ%3DsUmGBMv2DNw_zhJ3mYKbxkBVrXHQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgxo0AeaVpSa7%2BDztXyrpGndBJKxcCJr9DVos1G2Dc4JWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to