-1

1.I'm trying to update xml element values in test.xml file using ansible script with help of win_xml, my ansible playbook looks like below:

---
- 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.Run playbook using below command:

ansible-playbook -i ../hosts win-playbook.yml -vvv

3.This command failing with below error:

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

1 Answers1

0

If you are passing an **attribute** parameter then you should pass type: attribute. Rest looks good to me

Sakar Mehra
  • 89
  • 1
  • 11