Hey all, I have a task that I'm really struggling to convert into Ansible
from Python.
I'm uring the uri module to query an API and it returns the JSON output
like the following:
[
{
"Name": "Linux File System",
"Task": "Succeeded",
"Date": "epochdate"
},
{
"Name": "DB System",
"Task": "Succeeded",
"Date": "epochdate"
},
{
"Name": "Linux File System",
"Task": "Succeeded",
"Date": "epochdate"
},
{
"Name": "DB System",
"Task": "Succeeded",
"Date": "epochdate"
}
]
So a simple list of dicts...
However, the list will have two different types of `Name` in them, and
these aren't in order.
I can currently print out the JSON with the following:
- debug:
msg: "{{ data.json['items'] }}"
The outcome I am looking for is something like this:
Linux File System Succeeded Date
Linux File System Succeeded Date
Linux File System Succeeded Date
DB System Succeeded Date
DB System Succeeded Date
DB System Succeeded Date
So effectively split them into two separate groups.
I can do this with python just fine, however, I don't seem to be able to
grasp how to convert this into Ansible.
Can anyone put me on the right track here?
Thanks in advance!
--
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/441be486-6612-4d78-8e19-6eadaa49806f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.