1.我正在尝试在 win_xml 的帮助下使用 ansible 脚本更新 test.xml 文件中的 xml 元素值,我的 ansible playbook 如下所示:
---
- hosts: windows
gather_facts: no
tasks:
- name: Updating xml file
win_xml:
path: 'C:\test.xml'
xpath: '/properties/entry'
fragment: 'test'
attribute: 'key="test"'
type: text
2.使用以下命令运行剧本:
ansible-playbook -i ../hosts win-playbook.yml -vvv
3.此命令失败并出现以下错误:
The full traceback is:
The property 'SchemaInfo' cannot be found on this object. Verify that the property exists.
At line:118 char:1
+ $namespaceMgr.AddNamespace($xmlorig.$localname.SchemaInfo.Prefix, $na ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PropertyNotFoundStrict
ScriptStackTrace:
at <ScriptBlock>, <No file>: line 118
fatal: [windows]: FAILED! => {
"changed": false,
"msg": "Unhandled exception while executing module: The property 'SchemaInfo' cannot be found on this object. Verify that the property exists."
}