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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0a96577e-6a9f-459e-9c76-bc3cdda73bf5n%40googlegroups.com.

Reply via email to