- 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 - 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
--To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/448b7e2e-ebec-4b1e-9100-61bc8fd060bd%40googlegroups.com.
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJQqANeKhy5aNqjobbeQJ%3DsUmGBMv2DNw_zhJ3mYKbxkBVrXHQ%40mail.gmail.com.
well it does return content already, all the stdout and such.
register: result=std_out|to_json
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 }}"
- hosts: localhost
- name: Describe instances
hosts: localhost
gather_facts: false # Prevents immediately logging in to hosts
tasks:
- command: aws ec2 describe-instances
after: >
some python code to filter the results
some python code to register 5 groups
some python code to register 2 variables (register)
--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6e552272-5da4-48b4-acf7-8389265441a2%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2a3f8912-185c-444f-91d7-cb696022feae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@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/2a3f8912-185c-444f-91d7-cb696022feae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bd6cba6a-2336-456c-938e-7975fb5cb95f%40googlegroups.com.