Vagrant ansible provisioner throwing error 'MO

2019-09-22 04:22发布

This question already has an answer here:

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

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

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

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

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

1条回答
甜甜的少女心
2楼-- · 2019-09-22 04:55

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

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.

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

查看更多
登录 后发表回答