【发布时间】:2019-03-15 18:51:49
【问题描述】:
我正在尝试在 Azure VM 上运行 ansible playbook,但遇到了一个奇怪的问题。尝试安装任何软件(尝试 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 有效)
【问题讨论】:
-
这似乎与 0.10.12 (chocolatey.org/docs/release-notes) 中的重大更改有关
-
@Madison 请将此添加为答案,以便我可以投票并关闭,在任务解决问题之前注入禁用的增强退出代码!谢谢!!
-
还要确保链接到github.com/chocolatey/choco/issues/1758,我们指向 Ansible 已经应用修复来处理这些问题。
标签: windows azure ansible chocolatey