Ansible powershell 脚本不起作用 - 脚本未被识别为 cmdlet 的名称

Ansible powershell 脚本不起作用 - 脚本未被识别为 cmdlet 的名称

我正在尝试使用 ansible 停止 Windows 服务,但收到错误“无法识别脚本 \r\nas 是 cmdlet 的名称。”

以下是 Ansible yaml 文件中的任务:

  - name: Check if ERL is already installed
    win_service:
      name: RabbitMQ
      state: stopped

这是执行剧本时的错误:

TASK [Check if ERL is already installed] **************************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "/home/user1/.ansible/tmp/ansible-tmp-1629089159.6-1896-227877656238414/AnsiballZ_win_service.ps1 : The term \r\n'/home/user1/.ansible/tmp/ansible-tmp-1629089159.6-1896-227877656238414/AnsiballZ_win_service.ps1' is not recognized \r\nas the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was \r\nincluded, verify that the path is correct and try again.\r\nAt line:1 char:1\r\n+ /home/user1/.ansible/tmp/ansible-tmp-1629089159.6-1896-22787765623841 ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : ObjectNotFound: (/home/user1/.an...win_service.ps1:String) [], CommandNotFoundException\r\n    + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

相关内容