When using a provisioner in a Vagrantfile - I can't see where $username is
being being passed in, the error I'm seeing is:
DEBUG winrmshell: [WinRM] Processing output
> INFO interface: detail: Exception calling "RegisterTaskDefinition" with
> "7" argument(s): "(10,8):UserId:"
> At line:72 char:1
> + $folder.RegisterTaskDefinition($task_name, $task, 6, $username,
> $pass_to_use, $l ...
> +
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + CategoryInfo : NotSpecified: (:) [],
> MethodInvocationException
> + FullyQualifiedErrorId : ComMethodTargetInvocation
If I interactively run the script from the DEBUG output, I get the same
problem, if I first set $username, it works fine.
The VagrantFile I'm using is below, the username and password is the
default (vagrant/vagrant). As you can see, I've tried to specify the winrm
username too, though this should not be necessary:
# Machine parameters
nodes = [
{ :hostname => 'LABSQL01', :box => 'windows2012r2', :cpus => '2',
:maxmemory => '4096'}
]
vSwitch = "vExternal"
def provision_chocolatey(config)
config.vm.provision "shell" do |ps5|
ps5.inline = "iex ((new-object
net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
powershell_elevated_interactive = true
end
end
# Vagrant configuration (file format v2)
#
Vagrant.configure("2") do |config|
config.winrm.username = "vagrant"
nodes.each do |node|
# machine to base off
config.vm.box = node[:box]
# disabled shared folders
config.vm.synced_folder ".", "/vagrant", disabled: true
# set the vSwitch to use
config.vm.network "public_network", bridge: "vExternal"
# hyper-v specifics, see
https://www.vagrantup.com/docs/hyperv/configuration.html
config.vm.provider "hyperv" do |h|
h.vmname = node[:hostname]
h.cpus = node[:cpus]
# maxmemory is the maximum allowed via dynamic allocation
h.maxmemory = node[:maxmemory]
h.differencing_disk = true
h.auto_start_action = "Nothing"
h.auto_stop_action = "TurnOff"
h.ip_address_timeout = 600
end
provision_chocolatey(config)
end
end
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/a06a96de-5de7-48dd-9395-7f60ade1b6ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.