首页 > 解决方案 > 重启命令失败,错误是:关机:错误的日期转换:

问题描述

我正在为 Windows 使用 ansible。下面提到的重新启动剧本代码在一组机器中执行,而不是在另一组机器中执行。

---
-
  gather_facts: true
  hosts: SoftwareUpgrade
  tasks:
    -
      win_updates:
        category_names:
          - CriticalUpdates
          - SecurityUpdates
        reboot: no
    -
      win_reboot:
        msg: "Reboot initiated by Ansible"
        reboot_timeout: 7200
        post_reboot_delay: 600
        test_command: whoami
        connect_timeout: 5

错误

致命:[此处输入机器 FQDN]:失败!=> {"changed": false, "elapsed": 0, "msg": "Reboot command failed, error was: shutdown: Bad date conversion: /r\r\n\r\n#< CLIXML\r\n <Obj 版本="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"> System.Management.Automation.PSCustomObjectSystem.Object<I64 N="SourceId">1<PR N="Record">准备模块以供首次使用。0-1-1Completed-1 ", "rebooted": false, "start" :“2021-08-17T09:06:54.071067”}

工作盒在本地,失败在云上。另一个区别是操作系统(工作是 2012 年,失败是 2019 年)。

在运行与 Oracle 客户端安装、bat 运行、powershell 运行和安装 JDK 相关的其他剧本时,我没有看到任何问题。唯一的问题是重启命令(win_rebootansible 模块)。即使是没有任何参数的简单重启也会失败。

标签: windowsansiblereboot

解决方案


推荐阅读