jmespath prior to running json_query filter, yet already installed

2,586 views
Skip to first unread message

Bob M

unread,
Apr 7, 2020, 5:42:24 PM4/7/20
to Ansible Project

I'm running this section of code on a proxmox ansible controller. And I still get an error saying jmespath not found.

fatal: [master]: FAILED! => {"msg": "You need to install \"jmespath\" prior to running json_query filter"}
In the same playbook, as a pre-task, I've tried to apt install python3-jmespath and python-jmespath, and still get the error.

name06_create_vm_template | Install jmespath and proxmoxer via pip
  pip:
    name
      - jmespath
      - proxmoxer
  tags: [ install ]

name06_create_vm_template | set vm_ip_addrs from qm guest network-get-interfaces
  set_fact:
    vm_ip_addrs"{{ vm_ip_addrs + (template_ip | from_json | json_query(jmesquery) | ipaddr('10.9.0.10/16') | list) }}"
  vars:
    jmesquery'[*]."ip-addresses"[]."ip-address"'
  loop"{{ result.results | map(attribute='stdout') | list }}"
  loop_control:
    loop_var"template_ip"
    index_varcounter


Any ideas? Thanks!

Matt Martz

unread,
Apr 7, 2020, 6:03:15 PM4/7/20
to ansible...@googlegroups.com
You cannot install a dependency needed for a filter plugin, within the same playbook that requires it as a dependency.  Filter plugins are loaded at ansible startup, and the imports are processed and cached by python at this time.

As such, if it is missing at the beginning of the playbook execution, it will remain missing for the remainder of the execution.

I should also indicate that the dependency for filters, must be installed on the Ansible controller, and installed using the python used to run Ansible.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/62d18de2-d6d4-4508-95c0-6723f801bb68%40googlegroups.com.


--
Matt Martz
@sivel
sivel.net

Bob M

unread,
Apr 7, 2020, 7:25:01 PM4/7/20
to Ansible Project
Thank you Matt. I must have missed that in the documentation. I appreciate the help!!
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages