Vagrant 浮动ssh和ssh.private_密钥_路径不工作

Vagrant 浮动ssh和ssh.private_密钥_路径不工作,vagrant,Vagrant,这是我的档案 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| host_vars.each do |name| if name != "." and name != ".." config.vm.define name do |machine| data_host = YAML.load_file("#{dir}/../ansible/host_v

这是我的档案

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    host_vars.each do |name|

        if name != "." and name != ".."

            config.vm.define name do |machine|

                data_host = YAML.load_file("#{dir}/../ansible/host_vars/#{name}")

                machine.vm.hostname = File.basename("#{name}")
                machine.vm.box = "ubuntu/trusty64"

                machine.vm.provider "virtualbox" do |v|
                    v.name = name
                    v.memory = 2048
                    v.cpus = 2
                end

                machine.vm.network "private_network", ip: "#{data_host['ansible_ssh_host']}"

                machine.ssh.forward_agent = true

                if VAGRANT_COMMAND != "up" 
                    machine.ssh.username = "#{data_allhost['default_ssh_user_info']['name']}"
                    machine.ssh.host = "#{data_host['ansible_ssh_host']}"
                    machine.ssh.private_key_path = ["#{data_allhost['security_path']}/#{data_allhost['default_ssh_user_info']['private_authorized_keys']}"]
                end

            end

        end

    end

    config.vm.provision :ansible do |ansible|
            ansible.playbook = "../ansible/provision.yml"
            ansible.verbose = "vvvv"
        ansible.inventory_path = "../ansible/inventory/development"
        ansible.raw_arguments = ["-u","#{data_allhost['default_ssh_user_info']['name']}"]
    end

end
我能够成功地执行流浪者行动,没有任何问题

如果我尝试以这种方式连接:

ssh <user>@<host ip> -i <path to private key>
它不起作用。通过检查流浪日志:

 INFO ssh: Invoking SSH: ["cox@192.168.33.10", "-p", "2222", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "IdentitiesOnly=yes", "-i", "/home/updiversity/Virtualboxes/fisher/vagrant/.vagrant/machines/local.datadevserver.com/virtualbox/private_key", "-o", "ForwardX11=yes", "-o", "ForwardX11Trusted=yes", "-o", "ForwardAgent=yes"]
很明显,vagrant并没有向SSH命令传递正确的私钥路径,而是提供默认路径


这是一个bug吗?

也有同样的问题。。你找到解决办法了吗?
 INFO ssh: Invoking SSH: ["cox@192.168.33.10", "-p", "2222", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "IdentitiesOnly=yes", "-i", "/home/updiversity/Virtualboxes/fisher/vagrant/.vagrant/machines/local.datadevserver.com/virtualbox/private_key", "-o", "ForwardX11=yes", "-o", "ForwardX11Trusted=yes", "-o", "ForwardAgent=yes"]