如何使用vagrant 1.7.4设置ansible_local?

时间:2016-09-13 18:12:16

标签: vagrant ansible vagrantfile vagrant-provision

我有我的主机配置:

hedin@home:~/123$ lsb_release -rcd
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty
hedin@home:~/123$ vagrant -v
Vagrant 1.7.2

我尝试使用ansible_local规定部署我的访客。这是我的Vagrant文​​件:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  # Run Ansible from the Vagrant VM
  config.vm.provision "ansible_local" do |ansible|
    ansible.playbook = "playbook.yml"
  end
end

当我尝试部署它时,我收到了这个输出:

hedin@home:~/123$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The '' provisioner could not be found.

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

Vagrant v1.7版本有一个导致此错误的错误:

$ sudo dpkg -i ./vagrant_1.7.4_x86_64.deb
(Reading database ... 57030 files and directories currently installed.)
Preparing to unpack ./vagrant_1.7.4_x86_64.deb ...
Unpacking vagrant (1:1.7.4) over (1:1.7.3) ...
Setting up vagrant (1:1.7.4) ...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The 'ansible_local' provisioner could not be found.

升级到当前版本1.8.5(或至少1.8.0):

$ sudo dpkg -i vagrant_1.8.0_x86_64.deb
(Reading database ... 57030 files and directories currently installed.)
Preparing to unpack vagrant_1.8.0_x86_64.deb ...
Unpacking vagrant (1:1.8.0) over (1:1.7.4) ...
Setting up vagrant (1:1.8.0) ...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...