You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已安装Ansible Galaxy集合却提示module not found错误求助

问题:Ansible yaml模块执行报错ModuleNotFoundError: No module named 'jmespath'

已完成操作

  • 安装了Ansible Galaxy集合git_ogawa.yaml
  • 在控制节点安装依赖:
    pip install jmespath
    pip install ruamel.yaml
    

编写的Playbook

---
- name: Set IDs
  hosts: box8
  remote_user: torizon
  gather_facts: 'yes'
  collections:
      - git_ogawa.yaml
  vars_files:
      - vars/host_ids.yaml
  tasks:
      - name: Update IDs
        git_ogawa.yaml.update_yaml:
            path: '/tmp/manifest.yml'
            update:
                - key: SN
                  value: {{ apalis[ansible_hostname].SN }}

执行报错信息

[box8]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 192.168.0.211 closed.\r\n", "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/home/torizon/.ansible/tmp/ansible-tmp-1744286028.1389663-18113-231350830806892/AnsiballZ_update_yaml.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/torizon/.ansible/tmp/ansible-tmp-1744286028.1389663-18113-231350830806892/AnsiballZ_update_yaml.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/torizon/.ansible/tmp/ansible-tmp-1744286028.1389663-18113-231350830806892/AnsiballZ_update_yaml.py\", line 47, in invoke_module\r\n    runpy.run_module(mod_name='ansible_collections.git_ogawa.yaml.plugins.modules.update_yaml', init_globals=dict(_module_fqn='ansible_collections.git_ogawa.yaml.plugins.modules.update_yaml', _modlib_path=modlib_path),\r\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_git_ogawa.yaml.update_yaml_payload_grw_lzq_/ansible_git_ogawa.yaml.update_yaml_payload.zip/ansible_collections/git_ogawa/yaml/plugins/modules/update_yaml.py\", line 8, in <module>\r\n  File \"<frozen zipimport>\", line 259, in load_module\r\n  File \"/tmp/ansible_git_ogawa.yaml.update_yaml_payload_grw_lzq_/ansible_git_ogawa.yaml.update_yaml_payload.zip/ansible_collections/git_ogawa/yaml/plugins/module_utils/parse.py\", line 9, in <module>\r\nModuleNotFoundError: No module named 'jmespath'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

环境信息

控制节点

Ansible Version: 2.14.4
Python 3.10
OS: Linux Mint 21.1
Kernel: Linux 6.8.0-52-generic

目标主机box8

Python: 3.8
OS:TorizonCore Upstream 5.7.0-devel-20220808140737+build.0 (dunfell)
Kernel: 5.4.193-5.7.0-devel

补充说明

目标主机无网络连接,是搭载50GB焊接MMC芯片的小型PC。已尝试在控制节点用pip3安装依赖,还将模块复制到Ansible模块搜索路径,但问题仍未解决,寻求帮助。


内容的提问来源于stack exchange,提问作者Lumememmede Laenutus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 12:34:49