What version of Ansible added the json_query filter?

I’m currently running Ansible 2.1.0 and get an error when trying to use the json_query filter.

Example

  • name: Display filtered variable contents
    debug: var=item
    with_items: “{{ my_var | json_query(‘json.[*].percent’)}}”

I get the following Ansible error when run on remote hosts

"template error while templating string: no filter named ‘json_query’

I know this functionality relies on jmespath, and I do have a task defined to install jmespath via pip, like so (before the debug task above):

  • name: Run pip to install jmespath
    raw: pip install jmespath
    become: true
    become_method: sudo

Thanks!

Ben

json_query was added in v2.2

Thanks!