Vagrant ansible provisioner 在运行 playbook 时抛出错误“MODULE FAILURE" [英] Vagrant ansible provisioner throwing error 'MODULE FAILURE' when running playbook

查看:32
本文介绍了Vagrant ansible provisioner 在运行 playbook 时抛出错误“MODULE FAILURE"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过 Ubuntu Xenial 映像上的 vagrant 上的 ansible 配置程序运行剧本,但收到以下错误:

Trying to run a playbook through the ansible provisioner on vagrant on an Ubuntu Xenial image but receiving the following error:

PLAY [全部] **************************************************************************

PLAY [all] *********************************************************************

任务 [设置] ************************************************************************致命:[默认]:失败!=> {"changed": false, "failed": true, "module_stderr": "与 127.0.0.1 的共享连接已关闭.\r\n", "module_stdout": "\r\n/bin/sh: 1:/usr/bin/python: 未找到\r\n", "msg": "MODULE FAILURE"}要重试,请使用:--limit @/Users/user/Code/Vagrant/Ansible-Splunk-Ubuntu/test.retry

TASK [setup] ******************************************************************* fatal: [default]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to 127.0.0.1 closed.\r\n", "module_stdout": "\r\n/bin/sh: 1: /usr/bin/python: not found\r\n", "msg": "MODULE FAILURE"} to retry, use: --limit @/Users/user/Code/Vagrant/Ansible-Splunk-Ubuntu/test.retry

播放回顾****************************************************************************默认值:ok=0 已更改=0 无法访问=0 失败=1

PLAY RECAP ********************************************************************* default : ok=0 changed=0 unreachable=0 failed=1

Ansible 未能成功完成.任何错误输出都应该是上面可见.请修复这些错误,然后重试.

Ansible failed to complete successfully. Any error output should be visible above. Please fix these errors and try again.

推荐答案

原来 Vagrant 为我下载的 Ubuntu 镜像没有 Python(甚至没有 Python3)!

Turns out the Ubuntu image that Vagrant downloaded for me did not have Python (not even Python3)!

Ansible 需要 python2 才能正常运行.为了解决我的问题,我 ssh 进入了我的 Ubuntu VM 并运行了安装 Python2.7 的sudo apt-get install"python.

Ansible requires python2 in order to function properly. To solve my issue, I ssh'd into my Ubuntu VM and ran 'sudo apt-get install' python which installed Python2.7.

然后我再次从我的主机上配置了我的虚拟机——我的剧本运行良好,没有任何问题.

Then I provisioned my VM again from my host machine -- and my playbook ran fine without any problems.

更好的解决方案可能是在您的 vagrantfile 中包含一行,通过 shell 配置 python2.

A better solution would be to probably include a line in your vagrantfile that provisions python2 via the shell.

这篇关于Vagrant ansible provisioner 在运行 playbook 时抛出错误“MODULE FAILURE"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆