fatal: [hostname.domain]: FAILED! => {"changed": true, "cmd": "wusa.exe C:\\Temp\\Windows8.1-KB3042553-x64.msu /quiet /norestart", "delta": "0:00:00.109333", "end": "2017-04-11 04:57:09.337190", "failed": true, "rc": 5, "start": "2017-04-11 04:57:09.227857", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}
fatal: [hostname.domain]: FAILED! => {"changed": true, "cmd": "wusa.exe C:\\Temp\\Windows8.1-KB3042553-x64.msu /quiet /norestart", "delta": "0:00:00.281051", "end": "2017-04-11 04:57:09.321305", "failed": true, "rc": 5, "start": "2017-04-11 04:57:09.040254", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}
下面是剧本。
- hosts: all
tasks:
- name: Copy Patch from Control machine
win_copy:
src: /tmp/win_updates/
dest: C:\Temp\
- name: Extracting Patch on local machine
win_command: wusa.exe C:\Temp\Windows8.1-KB3042553-x64.msu /extract:C:\Temp
- name: Installing the Patch on local machine
win_command: dism.exe /online /add-package /PackagePath:C:\Temp\Windows8.1-KB3042553-x64.cab /NoRestart /quiet
答案1
看起来这不是 ansible 的问题,而是 wusa 的问题。根据退出代码 5 判断,这个 MS 文档
不支持在远程计算机上使用 WUSA 或 WUA API 安装更新。
并且 ansible 使用 PowerShell 远程处理来管理 Windows 主机。
也可以看看: