Hi,
I'm having a weird issue when using packer and chef-solo to configure winrm in windows 2008R2.
My setup is Windows2008R2 with OpenSSH.
I have a single recipe with a single simple resource:
powershell_script 'enable winrm' do
code <<-EOH
winrm quickconfig -q
EOH
end
It fails with this error:
virtualbox-ovf: [2014-12-11T12:03:41-08:00] INFO: Running queued delayed notifications before re-raising exception
virtualbox-ovf: [2014-12-11T12:03:41-08:00] ERROR: Running exception handlers
virtualbox-ovf: [2014-12-11T12:03:41-08:00] ERROR: Exception handlers complete
virtualbox-ovf: [2014-12-11T12:03:41-08:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
virtualbox-ovf: [2014-12-11T12:03:41-08:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: powershell_script[enable winrm] (paas_windows::enable_winrm line 1) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
virtualbox-ovf: ---- Begin output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -InputFormat None -File "C:/Users/Administrator/AppData/Local/Temp/chef-script20141211-1980-6u6cd3.ps1" ----
virtualbox-ovf: STDOUT:
virtualbox-ovf: STDERR: WSManFault Message = Access is denied
The same resource is executed properly if I execute chef-solo (installed by packer) in the same VM, with the same configuration and the same ssh credential from my terminal.
Example:
ssh -l Administrator localhost -p 4104 "c:/opscode/chef/bin/chef-solo --no-color -c c:/windows/temp/solo.rb -j c:/windows/temp/node.json"
[2014-12-11T12:17:17-08:00] INFO: Processing powershell_script[enable winrm] action run (paas_windows::enable_winrm line 1)
[2014-12-11T12:17:17-08:00] INFO: powershell_script[enable winrm] ran successfully
[2014-12-11T12:17:17-08:00] INFO: Chef Run complete in 0.609375 seconds
[2014-12-11T12:17:17-08:00] INFO: Running report handlers
[2014-12-11T12:17:17-08:00] INFO: Report handlers complete
follow my provisioners block:
"provisioners": [
{
"type": "chef-solo",
"cookbook_paths": ["./cookbook"],
"execute_command": "c:/opscode/chef/bin/chef-solo --no-color -c {{.ConfigPath}} -j {{.JsonPath}}",
"staging_directory": "c:/windows/temp",
"prevent_sudo": true,
"skip_install": false,
"run_list": ["paas_windows::enable_winrm"]
}
Any Ideas ?