mitchellh/vagrant-google

Unable to set username and password

slambdev opened this issue · 1 comments

Description

I am attempting to set the password of my machine, but it's continually hanging on the command. I referenced other examples within this repos history/issues, but unfortunately, it continues to hang. Any help is appreciated!

Example Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

vmname = "unreal-base"

Vagrant.configure("2") do |config|
  config.vm.box = "google/gce"

  config.vm.guest = :windows
  config.vm.communicator = "winrm"  
  config.winrm.port = 5986
  
  config.winrm.username = "shannen"
  config.winrm.password = "passw0rd"

  config.winrm.transport = :ssl
  config.winrm.ssl_peer_verification = false

  config.vm.define :winserver do |winserver|
    winserver.vm.synced_folder ".", "/vagrant", disabled: true
    
    winserver.vm.provider :google do |google, override|
      google.google_project_id = REDACTED
 
      google.image_family = "windows-2016"
      google.machine_type = "n1-standard-4"
      
      google.disk_size = "80"
      google.name = "dev"

      google.zone = "us-east4-c"

      google.setup_winrm_password = true

      google.tags = ['winrm', 'http-server', 'https-server']

      google.can_ip_forward = true

      google.accelerators = [{
        :type => "nvidia-tesla-p4-vws",
        :count => 1
      }]

      google.on_host_maintenance = "TERMINATE"

      override.winrm.port = 5986
      override.ssh.username = "shannen"
      override.ssh.private_key_path = "./tmp/id_rsa.pub"
    end
  end
end

Logs

Bringing machine 'winserver' up with 'google' provider...
==> winserver: Checking if box 'google/gce' version '0.1.0' is up to date...
==> winserver: Warning! The Google provider doesn't support any of the Vagrant
==> winserver: high-level network configurations (`config.vm.network`). They
==> winserver: will be silently ignored.
==> winserver: Launching an instance with the following settings...
==> winserver:  -- Name:                dev
==> winserver:  -- Project:              REDACTED
==> winserver:  -- Type:                 n1-standard-4
==> winserver:  -- Disk type:            pd-standard
==> winserver:  -- Disk size:            80 GB
==> winserver:  -- Disk name:            
==> winserver:  -- Image:                
==> winserver:  -- Image family:         windows-2016
==> winserver:  -- Instance Group:       
==> winserver:  -- Zone:                 us-east4-c
==> winserver:  -- Network:              default
==> winserver:  -- Network Project:      REDACTED
==> winserver:  -- Metadata:             '{}'
==> winserver:  -- Labels:               '{}'
==> winserver:  -- Network tags:         '["winrm", "http-server", "https-server"]'
==> winserver:  -- IP Forward:           true
==> winserver:  -- Use private IP:       false
==> winserver:  -- External IP:          
==> winserver:  -- Network IP:           
==> winserver:  -- Preemptible:          false
==> winserver:  -- Auto Restart:         true
==> winserver:  -- On Maintenance:       TERMINATE
==> winserver:  -- Autodelete Disk:      true
==> winserver:  -- Additional Disks:     []
==> winserver:  -- Accelerators:         [{:type=>"nvidia-tesla-p4-vws", :count=>1}]
==> winserver: Waiting for instance to become "ready"...
==> winserver: Machine is booted and ready for use!
==> winserver: Setting up WinRM Password
==> winserver: Temp Password: REDACTED
==> winserver: Waiting for WinRM To be ready
    winserver: WinRM address: REDACTED
    winserver: WinRM username: shannen
    winserver: WinRM execution_time_limit: PT2H
    winserver: WinRM transport: ssl
==> winserver: Changing password from temporary to winrm password # Hangs here
Vagrant timed out while attempting to connect via WinRM. This usually
means that the VM booted, but there are issues with the WinRM configuration
or network connectivity issues. Please try to `vagrant reload` or
`vagrant up` again.

Additional details

Vagrant v2.3.4

Screenshots

I did notice below. I have added my ssh keys to Metadata and VMs are supposed to inherit the ssh keys automatically so I didn't think this is an issue

Screenshot 2023-04-07 at 9 52 33 AM

From Metadata:

Screenshot 2023-04-07 at 9 53 36 AM

for anyone who runs into a similar issue...I've added the following and it helped get me further

      google.metadata = {
        'sysprep-specialize-script-cmd' => "googet -noconfirm=true install google-compute-engine-ssh",
        'enable-windows-ssh' => true
      }