Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 无法运行ansible playbook来运行bat文件_Windows_Powershell_Ansible - Fatal编程技术网

Windows 无法运行ansible playbook来运行bat文件

Windows 无法运行ansible playbook来运行bat文件,windows,powershell,ansible,Windows,Powershell,Ansible,我正在尝试运行ansible playbook,以便在windows本地计算机上运行bat文件 --- - hosts: localhost tasks: - name: Run command in cmd win_shell: sample.bat 但我收到错误-powershell:未找到。 请告诉我如何为ansible安装powershell解释器。请参阅有关使用cmd而不是powershell的文档/示例 # Run a com

我正在尝试运行ansible playbook,以便在windows本地计算机上运行bat文件

    ---
  - hosts: localhost
    tasks:
        - name: Run command in cmd
          win_shell: sample.bat
但我收到错误
-powershell:未找到。

请告诉我如何为ansible安装powershell解释器。

请参阅有关使用cmd而不是powershell的文档/示例

# Run a command under a non-Powershell interpreter (cmd in this case)
- win_shell: C:\path\sample.bat
  args:
    executable: cmd

.ps1
通常是powershell扩展…我尝试使用win shell命令,但收到以下错误。“加载任务时遇到格式错误的块:{u'args':{u'executable':u'cmd'},u'win\u shell':u'C:\..\\sample.bat',u'register':u'homedir\u out'}应为列表或无,但“Iam只是在bat文件中运行vbs文件。”。bat文件是否有任何特定格式可遵循,错误来自Ansible而非批处理脚本。此块在您的任务范围内