我有Ansible playbook运行CentOS版本5.6(最终)的机器。 我在目标机器上安装了simplejson,模块可以从python解释器导入。 但我的剧本仍然失败,出现以下错误。缺少SimpleJson模块
Error: ansible requires a json module, none found!
我在运行时通过原始模块确认了简单json模块的存在,如下所示。
---
-
gather_facts: false
hosts: "{{ host_group }}"
name: deploy
vars_files:
- "{{env}}.yml"
tasks:
- name: check python version
raw: python -c "import simplejson"
- name: "git checkout"
git: "repo={{repository}} dest={{base_dir}} version={{branch}}"
第一步成功,没有任何问题如下所示
TASK: [check python version] **************************************************
ok: [my-target-machine] => {"rc": 0, "stderr": "", "stdout": ""}
但与上述所述丢失JSON模块的错误的第二失败。
尝试安装'python-simplejson'模块 – itzMEonTV
@itzmeontv我已安装该模块。 python -c“导入simplejson”成功 –
Ansible要求将python-simplejson安装在EL盒子上<6. – itzMEonTV