I have been having nonstop trouble trying to get a windows server setup with vagrant and provision it with ansible. Im just curious if someone has vagrantfile example that I can use to make sure im doing this right. It either wont connect by winrm, ssh or fails when trying to set private Ips. I have the virtualbox plugin install on wsl and also pywinrm.
So since Winrm doesnt want to work even though its enabled and running on the vm, I tried using SSH and get a long traceback error.
Vagrant.configure("2") do |config|
config.vm.define "ad" do |ad|
ad.vm.box = "gusztavvargadr/windows-server-2019-standard"
ad.vm.network "private_network", ip: "192.168.56.10"
ad.vm.boot_timeout = 1800
ad.winrm.timeout = 1800
ad.vm.communicator = "ssh"
ad.ssh.insert_key = false
ad.ssh.shell = "powershell"
ad.winssh.shell = "powershell"
ad.vm.guest = :windows
ad.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "2048"
vb.cpus = "2"
vb.name = "ADDC-Server"
end
end
end
mike@MIKEPC:/mnt/c/Users/mkono/vagrant/ad$ vagrant reload
==> ad: Attempting graceful shutdown of VM...
==> ad: Checking if box 'gusztavvargadr/windows-server-2019-standard' version '1809.0.2303' is up to date...
==> ad: Clearing any previously set forwarded ports...
==> ad: Clearing any previously set network interfaces...
==> ad: Preparing network interfaces based on configuration...
ad: Adapter 1: nat
ad: Adapter 2: hostonly
==> ad: Forwarding ports...
ad: 3389 (guest) => 53389 (host) (adapter 1)
ad: 22 (guest) => 2222 (host) (adapter 1)
ad: 22 (guest) => 2222 (host) (adapter 1)
==> ad: Running 'pre-boot' VM customizations...
==> ad: Booting VM...
==> ad: Waiting for machine to boot. This may take a few minutes...
ad: SSH address: 172.31.240.1:2222
ad: SSH username: vagrant
ad: SSH auth method: private key
ad: Warning: Connection reset. Retrying...
==> ad: Machine booted and ready!
==> ad: Checking for guest additions in VM...
==> ad: Configuring and enabling network interfaces...
Traceback (most recent call last):
136: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/bin/vagrant:248:in `<main>'
135: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/environment.rb:301:in `cli'
134: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/cli.rb:67:in `execute'
133: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/commands/reload/command.rb:40:in `execute'
132: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/plugin/v2/command.rb:232:in `with_target_vms'
131: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/plugin/v2/command.rb:232:in `each'
130: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/plugin/v2/command.rb:243:in `block in with_target_vms'
129: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/commands/reload/command.rb:42:in `block in execute'
128: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:203:in `action'
127: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:203:in `call'
126: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/environment.rb:631:in `lock'
125: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:217:in `block in action'
124: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:248:in `action_raw'
123: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
122: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
121: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
120: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
119: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
118: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/check_virtualbox.rb:26:in `call'
117: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
116: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
115: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
114: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
113: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
112: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
111: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
110: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
109: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
108: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
107: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
106: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/check_virtualbox.rb:26:in `call'
105: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
104: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
103: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
102: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
101: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
100: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
99: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
98: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
97: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
96: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
95: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
94: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/discard_state.rb:15:in `call'
93: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
92: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
91: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
90: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
89: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
88: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
87: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
86: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
85: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
84: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
83: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
82: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
81: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
80: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
79: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
78: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
77: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
76: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
75: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
74: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
73: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
72: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
71: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
70: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/check_virtualbox.rb:26:in `call'
69: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
68: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
67: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
66: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/box_check_outdated.rb:93:in `call'
65: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
64: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
63: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
62: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
61: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
60: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
59: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
58: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
57: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
56: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
55: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
54: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
53: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
52: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
51: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
50: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
49: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
48: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
47: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
46: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
45: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
44: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
43: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
42: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
41: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
40: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
39: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
38: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/clean_machine_folder.rb:26:in `call'
37: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
36: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/set_name.rb:50:in `call'
35: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
34: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/clear_forwarded_ports.rb:15:in `call'
33: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
32: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/provision.rb:80:in `call'
31: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
30: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/env_set.rb:19:in `call'
29: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
28: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb:30:in `call'
27: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
26: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:52:in `call'
25: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
24: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/prepare_nfs_valid_ids.rb:12:in `call'
23: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
22: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
21: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
20: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
19: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
18: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/delayed.rb:19:in `call'
17: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
16: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/synced_folders.rb:87:in `call'
15: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
14: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/prepare_nfs_settings.rb:19:in `call'
13: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
12: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/set_default_nic_type.rb:64:in `call'
11: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
10: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/clear_network_interfaces.rb:26:in `call'
9: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
8: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/providers/virtualbox/action/network.rb:159:in `call'
7: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/guest.rb:45:in `capability'
6: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/capability_host.rb:111:in `capability'
5: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/capability_host.rb:111:in `call'
4: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/guests/windows/cap/configure_networks.rb:20:in `configure_networks'
3: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/guests/windows/cap/configure_networks.rb:60:in `create_vm_interface_map'
2: from /opt/ .3.4/gems/vagrant-2.3.4 /plugins/guests/windows/guest_network.rb:20:in `network_adapters' 1: from /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/guests/windows/guest_network.rb:83:in `wsman_version' /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/guests/windows/guest_network.rb:83:in `Integer': invalid value for Integer(): "'\\nPS C:\\\\Users\\\\vagrant> (>&2 printf '41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh')\\nPS C:\\\\Users\\\\vagrant> ((test-wsman).productversion.split(\\" \\") | select -last 1).split(\\"\\\\.\\")[0]\\n3\\r\\nPS C:\\\\Users\\\\vagrant> exit\\n" (ArgumentError)