Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
How to create a list from a hash
21 views
Skip to first unread message
Abey Thomas
unread,
Oct 31, 2017, 7:53:13 AM
10/31/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi,
I have got this hash
ok: [localhost] => {
"msg": {
"123": "hostname1",
"345": "hostname2"
}
}
I would like to create a new list from the above hash which contains only the values .
- hostname1
- hostname2
When I use variable.keys() I get the first fields I would like all the second fields in a new list. Is this possible?
I got the hash after using combine().
Regards,
Abey
Dick Visser
unread,
Nov 3, 2017, 9:28:33 PM
11/3/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Something like this:
values: "{{ msg | json_query('*') }}"
> --
> 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/8c9736e8-58db-41ab-9080-984bfd653ba1%40googlegroups.com
.
> For more options, visit
https://groups.google.com/d/optout
.
--
Dick Visser
GÉANT
Want to join us? We're hiring:
https://www.geant.org/jobs
Abey Thomas
unread,
Nov 6, 2017, 8:28:47 AM
11/6/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi Dick,
Thanks. That worked.
ok: [localhost] => {
"msg": [
"hostname1",
"hostname1"
]
}
Never used JMESPath until now!
Abey
Reply all
Reply to author
Forward
0 new messages