简体   繁体   English

Ansible Chocolatey神秘失败?

[英]Ansible Chocolatey failing mysteriously?

I am trying to run an ansible playbook on an Azure VM, but I am running into a strange problem. 我试图在Azure VM上运行一个ansible playbook,但我遇到了一个奇怪的问题。 Attempting to install any software (attempted git, sysinternals, nscp) just doesn't fire. 尝试安装任何软件(尝试git,sysinternals,nscp)都不会触发。

win_chocolatey:
        name: git
        state: present  

Does not even trigger an install attempt. 甚至不会触发安装尝试。 Nothing in the logs other than attempting to list the software. 除了尝试列出软件之外,日志中没有任何内容。 It just attempts to list the software, and throws out that it's not present (because said software is not installed) 它只是试图列出软件,并抛出它不存在(因为没有安装所述软件)

win_chocolatey:
        name: git
        state: absent  

Works perfectly fine, after manually installing git. 手动安装git后,工作完美。 I have tried installing the package manually using the command win_chocolatey would use (according to the docs) and it works. 我已经尝试使用win_chocolatey将使用的命令手动安装包(根据文档)并且它可以工作。 Using the exact same user as the playbook is. 使用与剧本完全相同的用户。 (has admin rights) (拥有管理员权限)

I've also tried to force the admin account with become , (even though it already runs admin) but it mattered not. 我也尝试强制管理帐户become ,(即使它已经运行管理员),但它不重要。

-vvvv is not even showing an install attempt either: -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": []
}

Am I missing something? 我错过了什么吗? The docs ( https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html#examples ) say that even something basic like: 文档( https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html#examples )说即使是基本的东西,如:

- name: Install git
  win_chocolatey:
    name: git

Should install the package (state present or not, I've tried it with no state, and any other, only absent works) 应该安装包(状态是否存在,我已经尝试过没有状态,任何其他,只有absent工作)

Enhanced exit codes were added to Chocolatey 0.10.12 which is listed as a breaking change. 增强的退出代码被添加到Chocolatey 0.10.12中,其被列为重大变化。

chocolatey.org/docs/release-notes chocolatey.org/docs/release-notes

Ansible changes are already being made to fix this (see github.com/chocolatey/choco/issues/1758 ), but for now you can disable the feature per the release notes 已经进行了Ansible更改以解决此问题(请参阅github.com/chocolatey/choco/issues/1758 ),但是现在您可以根据发行说明禁用该功能

choco feature disable --name="'useEnhancedExitCodes'"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM