简体   繁体   English

appcmd.exe 命令导致 win_command 模块出错

[英]appcmd.exe command causing error in win_command module

I'm trying to run multiline command into the following script for urlrewrite https redirection under IIS through ansible playbook with the win_command but it shows error even i tried to put only the first command line into the win_command :我正在尝试通过使用win_command playbook 将多行命令运行到以下脚本中,以便在 IIS 下进行 urlrewrite https 重定向,但即使我尝试仅将第一个命令行放入win_command ,它也显示错误:

- name: configure https redirection urlrewrite
  win_command: appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].match.url:"(client*)""
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsFile']"
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsDirectory']"
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.type:"Rewrite""
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.url:"client/index.html""

You need to add one command before these executed, otherwise appcmd will not find rule.你需要在执行这些命令之前添加一个命令,否则 appcmd 将找不到规则。 I have tested it and succeeded我已经测试过并成功了

appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS']"

这是执行结果 网页配置

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

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