gpt4 book ai didi

json - 错误 : ansible requires a json module, 未找到

转载 作者:行者123 更新时间:2023-12-02 03:21:17 25 4
gpt4 key购买 nike

执行ansible ping模块时出错

bash ~ ansible webservers  -i inventory -m ping  -k  -u root -vvvv
SSH password:
<~> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO ~
<my-lnx> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO my-lnx
~ | FAILED => FAILED: [Errno 8] nodename nor servname provided, or not known
<my-lnx> REMOTE_MODULE ping
<my-lnx> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582 && echo $HOME/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582'
<my-lnx> PUT /var/folders/8n/fftvnbbs51q834y16vfvb1q00000gn/T/tmpP6zwZj TO /root/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582/ping
<my-lnx> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582/ping; rm -rf /root/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582/ >/dev/null 2>&1'
my-lnx | FAILED >> {
"failed": true,
"msg": "Error: ansible requires a json module, none found!",
"parsed": false
}

这是我的库存文件

bash ~ cat inventory 
[webservers]
my-lnx ansible_ssh_host=my-lnx ansible_ssh_port=22

我也在客户端和远程计算机中安装了 simplejosn 模块

bash ~ pip list | grep json
simple-json (1.1)
simplejson (3.6.5)

最佳答案

我认为您需要安装python-simplejson模块。

尝试先运行此命令,然后运行您想要的命令:

 ansible webservers -i inventory -m raw -a "sudo yum install -y python-simplejson"  -k  -u root -vvvv

我认为是旧的 Red Hat/CentOS 系统。

关于json - 错误 : ansible requires a json module, 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28380771/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com