Vagrant-Azure:访客计算机无法连接到主机(无法复制SMB文件)

时间:2019-12-23 09:48:45

标签: azure vagrant vagrantfile vagrant-plugin

直到现在,我一直只在本地从事Vagrant的工作,现在我想以Azure作为提供程序来创建VM,但是不幸的是,我通过链接可以在映像上看到该错误。我理解它的意思,但是我绝对不知道如何解决它。 Error

我还要附加我的Vagrantfile:

require 'vagrant-azure'
Vagrant.configure("2") do |config|
  config.vm.box = 'azure'
  config.vm.box_url = 'https://github.com/azure/vagrant-azure/raw/master/dummy.box'

  config.vm.network "private_network", guest: 80, host: 80

  config.ssh.username = 'vagrant'
  config.ssh.private_key_path = '~/.ssh/id_rsa'

  config.vm.synced_folder '.', '/vagrant', :disabled => true

  config.vm.provider :azure do |azure, override|
    azure.tenant_id = ****
    azure.client_id = ****
    azure.client_secret = ****
    azure.subscription_id = ****

    azure.tcp_endpoints = '80'

    azure.vm_name = 'grafmuvivm'
    azure.vm_size = 'Standard_B1s'
    azure.vm_image_urn = 'Canonical:UbuntuServer:18.04-LTS:latest'
    azure.resource_group_name = 'grafmuvirg'
    azure.location = 'westeurope'
    virtual_network_name = 'grafmuvivm-vagrantPublicIP'
  end

  # Declare where chef repository path
  chef_repo_path = "./chef"

  # Provisioning Chef-Zero
  config.vm.provision :chef_zero do |chef|
    # Added necessary chef attributes
    chef.cookbooks_path = 'chef/cookbooks'
    chef.nodes_path = 'chef/cookbooks'

    #### Adding recipes ####
    chef.add_recipe "api::ssh_user"
    chef.add_recipe "api::grafmuvi"

    # Running recipes
    chef.run_list = [
      'recipe[api::ssh_user]',
      'recipe[api::grafmuvi]'
    ]
    # Accept chef license
    chef.arguments = "--chef-license accept"
  end
end

如果我运行“ vagrant up --debug”,则可以看到来宾计算机无法ping通任何主机IP。

有人可以告诉我如何在Vagrant上正确设置网络吗?我已经检查了与该主题相关的GitHub问题,但没有发现任何有用的信息...

编辑:

Running 'vagrant provision'

1 个答案:

答案 0 :(得分:0)

我与Vagrant合作,但没有与Vagrant-azure合作。但是,您可以通过以下方式更改配置并显示输出:

        azure.vm.network "private_network", ip: "192.168.50.10"