Ansible Chocolatey 神秘失败?
Ansible Chocolatey failing mysteriously?
我正在尝试 运行 Azure VM 上的 ansible 剧本,但我 运行 遇到了一个奇怪的问题。尝试安装任何软件(尝试 git、sysinternals、nscp)都不会触发。
win_chocolatey:
name: git
state: present
甚至不会触发安装尝试。除了尝试列出软件外,日志中没有任何内容。它只是试图列出软件,并抛出它不存在(因为未安装所述软件)
win_chocolatey:
name: git
state: absent
在手动安装 git 后工作得很好。我已经尝试使用 win_chocolatey 将使用的命令手动安装包(根据文档)并且它有效。使用与剧本完全相同的用户。 (拥有管理员权限)
我也尝试过使用 become
强制使用管理员帐户(即使它已经是 运行 的管理员),但这并不重要。
-vvvv
甚至没有显示安装尝试:
TASK [Download and install chocolatey packages] **************************************************************
task path: /usr/user/clouddrive/windows-vm/create-vm-windows.yml:162
Using module file /opt/ansible/local/lib/python2.7/site-packages/ansible/modules/windows/win_chocolatey.ps1
<my.ip.address.here> ESTABLISH WINRM CONNECTION FOR USER: AzureAdministrator on PORT 5986 TO my.ip.address.here
checking if winrm_host my.ip.address.here is an IPv6 address
EXEC (via pipeline wrapper)
failed: [my.ip.address.here] (item={u'choco_name': u'git', u'choco_state': u'present'}) => {
"changed": false,
"command": "C:\ProgramData\chocolatey\bin\choco.exe list --local-only --exact --limit-output git",
"item": {
"choco_name": "git",
"choco_state": "present"
},
"msg": "Error checking installation status for the package 'git'",
"rc": 2,
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}
我错过了什么吗?文档 (https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html#examples) 说即使是一些基本的东西,比如:
- name: Install git
win_chocolatey:
name: git
应该安装包(状态存在与否,我试过没有状态,任何其他,只有 absent
有效)
Chocolatey 0.10.12 中添加了增强的退出代码,这被列为重大更改。
chocolatey.org/docs/release-notes
已经进行了 Ansible 更改来修复此问题(请参阅 github.com/chocolatey/choco/issues/1758),但现在您可以根据发行说明禁用该功能
choco feature disable --name="'useEnhancedExitCodes'"
我正在尝试 运行 Azure VM 上的 ansible 剧本,但我 运行 遇到了一个奇怪的问题。尝试安装任何软件(尝试 git、sysinternals、nscp)都不会触发。
win_chocolatey:
name: git
state: present
甚至不会触发安装尝试。除了尝试列出软件外,日志中没有任何内容。它只是试图列出软件,并抛出它不存在(因为未安装所述软件)
win_chocolatey:
name: git
state: absent
在手动安装 git 后工作得很好。我已经尝试使用 win_chocolatey 将使用的命令手动安装包(根据文档)并且它有效。使用与剧本完全相同的用户。 (拥有管理员权限)
我也尝试过使用 become
强制使用管理员帐户(即使它已经是 运行 的管理员),但这并不重要。
-vvvv
甚至没有显示安装尝试:
TASK [Download and install chocolatey packages] **************************************************************
task path: /usr/user/clouddrive/windows-vm/create-vm-windows.yml:162
Using module file /opt/ansible/local/lib/python2.7/site-packages/ansible/modules/windows/win_chocolatey.ps1
<my.ip.address.here> ESTABLISH WINRM CONNECTION FOR USER: AzureAdministrator on PORT 5986 TO my.ip.address.here
checking if winrm_host my.ip.address.here is an IPv6 address
EXEC (via pipeline wrapper)
failed: [my.ip.address.here] (item={u'choco_name': u'git', u'choco_state': u'present'}) => {
"changed": false,
"command": "C:\ProgramData\chocolatey\bin\choco.exe list --local-only --exact --limit-output git",
"item": {
"choco_name": "git",
"choco_state": "present"
},
"msg": "Error checking installation status for the package 'git'",
"rc": 2,
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}
我错过了什么吗?文档 (https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html#examples) 说即使是一些基本的东西,比如:
- name: Install git
win_chocolatey:
name: git
应该安装包(状态存在与否,我试过没有状态,任何其他,只有 absent
有效)
Chocolatey 0.10.12 中添加了增强的退出代码,这被列为重大更改。
chocolatey.org/docs/release-notes
已经进行了 Ansible 更改来修复此问题(请参阅 github.com/chocolatey/choco/issues/1758),但现在您可以根据发行说明禁用该功能
choco feature disable --name="'useEnhancedExitCodes'"