我正在尝试使用ansible创建并配置多机器流浪者环境。
我的Vagrant文件如下:
ls z*
z0.png z10.png z12.png z14.png z16.png z18.png z2.png z4.png z6.png z8.png
z1.png z11.png z13.png z15.png z17.png z19.png z3.png z5.png z7.png z9.png
端
我可以通过做一个流浪汉创建机器--no-provision,我可以通过做vagrant ssh web(例如)来登录机器。
但是,当我尝试配置计算机时,收到以下错误消息:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
(1..3).each do |i|
config.vm.define "db#{i}" do |node|
node.vm.box = "trusty64"
node.vm.network "public_network", ip: "192.168.253.20#{i}", bridge: 'en0: Wi-Fi (AirPort)'
node.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 512]
v.name = "db#{i}_box"
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end
end
(1..1).each do |i|
config.vm.define "es#{i}" do |node|
node.vm.box = "trusty64"
node.vm.network "public_network", ip: "192.168.253.21#{i}", bridge: 'en0: Wi-Fi (AirPort)'
node.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.name = "es#{i}_box"
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end
end
config.vm.define "emailchecker" do |node|
node.vm.box = "trusty64"
node.vm.network "public_network", ip: "192.168.253.205", bridge: 'en0: Wi-Fi (AirPort)'
node.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.name = "emailchecker_box"
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end
config.vm.define "smartrouter" do |node|
node.vm.box = "trusty64"
node.vm.network "public_network", ip: "192.168.253.206", bridge: 'en0: Wi-Fi (AirPort)'
node.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.name = "smartrouter_box"
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end
config.vm.define "web" do |node|
node.vm.box = "trusty64"
node.vm.network "public_network", ip: "192.168.253.204", bridge: 'en0: Wi-Fi (AirPort)'
node.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.name = "web_box"
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
####
#
# Note Provisioning is included here to ensure it only gets run once on all the boxes.
#
####
node.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible_playbook/playbook.yml"
ansible.verbose = "vvvv"
ansible.limit = 'all'
ansible.inventory_path = "ansible_playbook/vagrant_inventory"
end
end
有没有人知道这里可能会发生什么,或者有关我如何调试/解决这个问题的建议?
谢谢,
肖恩
答案 0 :(得分:1)
我之前看过这个错误,通常是空格!
似乎当SSH密钥的路径包含空格时,这些都没有被正确转义,实际上破坏了Ansible。
我可能完全不在这里,但我过去已经重新检查了流浪文件,发现情况确实如此。
另一个想法,如果你有任何引用localhost而不是127.0.0.1