I am trying to learn how to insert a new element after the <jboss-cli...> element.
Contents of the xml file
<?xml version='1.0' encoding='UTF-8'?>
<!--
WildFly Command-line Interface configuration.
-->
<jboss-cli xmlns="urn:jboss:cli:3.4">
<default-protocol use-legacy-override="true">remote+http</default-protocol>
<!-- The default controller to connect to when 'connect' command is executed w/o arguments -->
<default-controller>
<protocol>remote+http</protocol>
<host>xx.xx.xx.xx</host>
<port>9990</port>
</default-controller>
</jboss-cli>
This is my task:
- name: Insert element after jboss-cli element
community.general.xml:
add_children:
- "<jwh>Inserted</jwh>"
input_type: xml
namespaces:
x: urn:jboss:cli:3.4
path: /opt/wildfly/wf29/bin/jboss-cli.xml
pretty_print: true
xpath: "/x:jboss-cli"
When I execute the role containing this task, I get
FAILED! => {"changed": false, "msg": "Syntax error in xpath expression: /x:jboss-cli/ (Invalid expression)"
How do I insert this new element immediately following the <jboss-cli xmlns="urn:jboss:cli:3.4">?
I've tried xpath:"x:"
I've tried xpath: "/"
I've tried xpath: "/x:"
Thanks