votes up 4

You need to install "jmespath" prior to running json_query filter

Package:
ansible
github stars 49704
Exception Class:
AnsibleError

Raise code

on_query(data, expr):
    '''Query data using jmespath query language ( http://jmespath.org ). Example:
    - debug: msg="{{ instance | json_query(tagged_instances[*].block_device_mapping.*.volume_id') }}"
    '''
    if not HAS_LIB:
        raise AnsibleError('You need to install "jmespath" prior to running '
                           'json_query filter')

    try:
        return jmespath.search(expr, data)
    except jmespath.exceptions.JMESPathError as e:
        raise AnsibleFilterError('JMESPathError in json_query filter plugin:\n%s' % e)
    except Exception as e:
        

Ways to fix

votes up 1 votes down

This Exception just means that the Jmespath package is not installed, Ansible attempts to import it then stores if that worked as a boolean. meaning if the import fails the exception is raised. the way to fix this is to make sure that Jmespath is installed.

install using pip :

pip install jmespath

or with pip3:

pip3 install jmespath
Jun 23, 2021 huffnagledean answer

Add a possible fix

Please authorize to post fix