«

ansible json_query filter issue

I ran into this issue last week trying to use a json_query filter with an ansible role.

fatal: [target]: FAILED! => {“failed”: true, “msg”: “You need to install \“jmespath\” prior to running json_query filter”}

So first, I did the sensible thing and ran pip install jmespath on my local machine and tried again.

Same issue

So my next thought was okay, maybe jmespath needs to be installed on the host. No problem, added a bit to install jsmespath on the host and tried again.

Same issue

So after several more hours of googling, stack overflow and banging my head against desk. I asked my question on [Reddit] (“https://www.reddit.com/r/ansible/comments/5nmcnk/issue_with_json_query_filter/") and finally got an answer, or at least something to look at. So when I installed ansible, I used [homebrew] (“http://www.brew.sh") and that runs it’s own little python environment (maybe look into that more later). When I installed jmespath earlier it was in a different environment than the ansible version installed by homebrew. The next thing I did was uninstall the homebrew version and install it from pip pip install ansible. After that everything just worked.