1
votes

I've been working on Vagrant only locally until now and now I want to create VM with Azure as the provider, but unfortunately I've got the error that can be seen on the image accesible through the link. I understand what it says but I have absolutely no idea how to fix it. Error

I am also appending my 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

If I run 'vagrant up --debug' it can be seen that guest machine cannot ping any of the host machine IPs.

Could someone please tell me how to properly setup networking on Vagrant? I've checked the GitHub issues related to this topic but I didn't find anything useful...

EDIT:

Running 'vagrant provision'

1

1 Answers

0
votes

I worked with Vagrant but not with Vagrant-azure. But, can you change configuration in the following way and show the output:

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