You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the json_query plugin to filter a json object but keep getting the same error message. I've tried using the workaround mentioned in #320 but still get the same error.
[WARNING]: No inventory was parsed, only implicit localhost is available[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'PLAY [localhost] ****************************************************************************************************************************************TASK [set_fact] *****************************************************************************************************************************************fatal: [localhost]: FAILED! => {"msg": "Error in jmespath.search in json_query filter plugin:\n'method' object is not iterable"}PLAY RECAP **********************************************************************************************************************************************localhost
Code of Conduct
I agree to follow the Ansible Code of Conduct
The text was updated successfully, but these errors were encountered:
hosts: localhostvars:
vms: {"vms": {"json": {"resources": [{"ips": ["192.168.1.10", "10.0.0.10"], "name": "vm-001"}, {"ips": ["192.168.1.11", "10.0.0.11"], "name": "vm-002"}]}}}tasks:
- set_fact:
my_vm: "{{ vms | json_query(query) }}"vars: # vars should be at the same indentation as the task not the task optionsquery: vms.json.resources[?ips.contains(@, `192.168.1.11`)].name # Note the top-level object 'vms' and the backticks around the literal value
- debug:
msg: "{{ my_vm }}"
Summary
I'm trying to use the
json_query
plugin to filter a json object but keep getting the same error message. I've tried using the workaround mentioned in #320 but still get the same error.Issue Type
Bug Report
Component Name
json_query
Ansible Version
Configuration
$ ansible-config dump --only-changed
OS / Environment
MacOS BigSur 11.2.3
Steps to Reproduce
Expected Results
i should get an output containing
[“vm-002”]
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: