Ansible: filter a list by its attributes

Question:

I have variable named “network” registered in Ansible:

Is it possible to get the IP address (“addr”) with type=”floating” doing something like this?

I know the syntax is wrong but you get the idea.

Answer:

I’ve submitted a pull request (available in Ansible 2.2+) that will make this kinds of situations easier by adding jmespath query support on Ansible. In your case it would work like:


would return:

Leave a Reply