Ansible 2.0: Chocolatey Fails

222 views
Skip to first unread message

Slim Slam

unread,
Jan 13, 2016, 12:31:59 PM1/13/16
to Ansible Project
It's not clear if this is just because of lack of documentation (probably) or if Chocolatey routinely fails.

Here's what I'm trying to do on Windows Server 2008R2:

    - name: Add git
      win_chocolatey
:
        name
: git
        state
: present

It appears that Chocolately, as the doc says, tries to install itself (because it is not present on the machine) but everything still fails:

TASK [Add git] *****************************************************************
task path
: /Users/myname/build_win.yml:36
<52.xx.xx.xx> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 52.xx.xx.xx
<52.xx.xx.xx> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name "ansible-tmp-1452704429.8-175641097129663").FullName | Write-Host -Separator '';
<52.xx.xx.xx> PUT "/var/folders/lg/c_x9gpnj3kx6ssg58nkdd2m00000gn/T/tmpsYePR4" TO "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1452704429.8-175641097129663\win_chocolatey.ps1"
<52.xx.xx.xx> EXEC Set-StrictMode -Version Latest
Try
{
& "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1452704429.8-175641097129663\win_chocolatey.ps1"
}
Catch
{
$_obj
= @{ failed = $true }
If ($_.Exception.GetType)
{
$_obj
.Add('msg', $_.Exception.Message)
}
Else
{
$_obj
.Add('msg', $_.ToString())
}
If ($_.InvocationInfo.PositionMessage)
{
$_obj
.Add('exception', $_.InvocationInfo.PositionMessage)
}
ElseIf ($_.ScriptStackTrace)
{
$_obj
.Add('exception', $_.ScriptStackTrace)
}
Try
{
$_obj
.Add('error_record', ($_ | ConvertTo-Json | ConvertFrom-Json))
}
Catch
{
}
Echo $_obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Finally { Remove-Item "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1452704429.8-175641097129663" -Force -Recurse -ErrorAction SilentlyContinue }
fatal
: [52.xx.xx.xx]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "win_chocolatey"}, "module_stderr": "", "module_stdout": "\r\nMode                LastWriteTime     Length Name                              \r\n----                -------------     ------ ----                              \r\nd----         1/13/2016   5:00 PM            chocInstall                       \r\nDownloading https://packages.chocolatey.org/chocolatey.0.9.9.11.nupkg to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip\r\nDownload 7Zip commandline tool\r\nDownloading https://chocolatey.org/7za.exe to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\7za.exe\r\nExtracting C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall...\r\nInstalling chocolatey on this machine\r\n{\"changed\":false,\"msg\":\"The term \\u0027C:\\\\Users\\\\ADMINI~1\\\\AppData\\\\Local\\\\Temp\\\\chocolatey\\\\chocInstall\\\\tools\\\\chocolateyInstall.ps1\\u0027 is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.\",\"failed\":true}\r\n\r\n\r\n\r\n7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18\r\n\r\nProcessing archive: C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\chocolatey\\chocInstall\\chocolatey.zip\r\n\r\nExtracting  _rels\\.rels\r\nExtracting  chocolatey.nuspec\r\nExtracting  tools\\chocolateyInstall.ps1\r\nExtracting  tools\\chocolateysetup.psm1\r\nExtracting  tools\\init.ps1\r\nExtracting  tools\\chocolateyInstall\\choco.exe\r\nExtracting  tools\\chocolateyInstall\\choco.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\LICENSE.txt\r\nExtracting  tools\\chocolateyInstall\\helpers\\chocolateyInstaller.psm1\r\nExtracting  tools\\chocolateyInstall\\helpers\\chocolateyScriptRunner.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-BinRoot.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-CheckSumValid.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-ChocolateyUnzip.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-ChocolateyWebFile.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-EnvironmentVariable.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-EnvironmentVariableNames.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-FtpFile.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-ProcessorBits.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-UACEnabled.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-VirusCheckValid.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-WebFile.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Get-WebHeaders.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-BinFile.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyDesktopLink.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyEnvironmentVariable.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyExplorerMenuItem.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyFileAssociation.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyInstallPackage.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyPackage.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyPath.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyPinnedTaskBarItem.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyPowershellCommand.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyShortcut.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyVsixPackage.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Install-ChocolateyZipPackage.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Set-EnvironmentVariable.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Start-ChocolateyProcessAsAdmin.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Test-ProcessAdminRights.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Uninstall-BinFile.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Uninstall-ChocolateyPackage.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\UnInstall-ChocolateyZipPackage.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Update-SessionEnvironment.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Write-ChocolateyFailure.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Write-ChocolateySuccess.ps1\r\nExtracting  tools\\chocolateyInstall\\helpers\\functions\\Write-FileUpdateLog.ps1\r\nExtracting  tools\\chocolateyInstall\\redirects\\choco.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\choco.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\chocolatey.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\chocolatey.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\cinst.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\cinst.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\clist.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\clist.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\cpack.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\cpack.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\cpush.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\cpush.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\cuninst.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\cuninst.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\cup.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\cup.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\cver.exe\r\nExtracting  tools\\chocolateyInstall\\redirects\\cver.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\redirects\\RefreshEnv.cmd\r\nExtracting  tools\\chocolateyInstall\\tools\\7za.exe\r\nExtracting  tools\\chocolateyInstall\\tools\\7za.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\tools\\7za.exe.manifest\r\nExtracting  tools\\chocolateyInstall\\tools\\7zip.license.txt\r\nExtracting  tools\\chocolateyInstall\\tools\\checksum.exe\r\nExtracting  tools\\chocolateyInstall\\tools\\checksum.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\tools\\checksum.license.txt\r\nExtracting  tools\\chocolateyInstall\\tools\\shimgen.exe\r\nExtracting  tools\\chocolateyInstall\\tools\\shimgen.exe.ignore\r\nExtracting  tools\\chocolateyInstall\\tools\\shimgen.license.txt\r\nExtracting  package\\services\\metadata\\core-properties\\d830953f078f45f99a2e4d814d1b7974.psmdcp\r\nExtracting  [Content_Types].xml\r\n\r\nEverything is Ok\r\n\r\nFiles: 76\r\nSize:       4893948\r\nCompressed: 1806765\r\n", "msg": "MODULE FAILURE", "parsed": false}


PLAY RECAP
*********************************************************************
52.xx.xx.xx                : ok=1    changed=0    unreachable=0    failed=1
localhost                  
: ok=10   changed=2    unreachable=0    failed=0

Brian Coca

unread,
Jan 13, 2016, 12:48:52 PM1/13/16
to Ansible Project
the module seems to be returning non JSON output for some reason, this
is a bug, please open an issue in github.
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f2cbd126-fe1c-45ad-a0a9-b2f448bb9488%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Slim Slam

unread,
Jan 13, 2016, 2:22:33 PM1/13/16
to Ansible Project
Reply all
Reply to author
Forward
0 new messages