-1

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."
}
4

1 回答 1

0

如果你传递一个**attribute**参数,那么你应该传递type: attribute. 休息对我来说很好

于 2020-04-17T05:31:13.950 回答