xml - Ansible win_xml 删除 xml 元素失败
问题描述
安装 iis 尝试从 applicationhost.config 中删除默认网站文档文件后,我在 ansible playbook 中运行以下任务。
- name: Remove defaultDocument Files From applicationhost.config
win_xml:
path: C:\Windows\System32\inetsrv\Config\applicationHost.config
xpath: /configuration/system.webServer/defaultDocument/files/*
state: absent
播放失败并出现以下错误:
The full traceback is:
The property 'removed' cannot be found on this object. Verify that the property exists.
At line:162 char:21
+ ... $result.removed += $result.removed + $removedNode.get_Out ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PropertyNotFoundStrict
ScriptStackTrace:
at <ScriptBlock>, <No file>: line 162
fatal: [win2019-local-096]: FAILED! => {
"changed": false,
"msg": "Unhandled exception while executing module: The property 'removed' cannot be found on this object. Verify that the property exists."
}
解决方案
原来这是一个问题,因为我正在使用 debug -vvvv 运行我的剧本,以便我可以调试输出。一旦我运行它而没有冗长,它就成功了。
推荐阅读
- javascript - 如何在javascript中监听多个按钮点击
- amazon-web-services - 集群 amazon RDS 多可用副本以降低成本是否可行?
- ios - SwiftUI 中的上下文菜单预览没有圆角
- python - 将正则表达式列表与字符串列表匹配
- android - 安装 drozer 工具时出现问题,adb install 说问题如下图所示,g path 或 adb 有问题
- python - 如何一个接一个地打印字母并扩展它
- node.js - 什么会导致 ipc 回调返回一个值而不是运行时的值?
- python - 如何用文件名替换熊猫数据框中的单元格值?
- java - 有没有一种简单的方法可以通过它的值对地图的键进行排序?
- list - 使用 List.Genrate 的 PowerBI 表达式错误