Невозможно установить атрибут узла, используя ANSIBLE XML - PullRequest
0 голосов
/ 03 июля 2019

Я пытаюсь настроить задачу, которая добавит новый атрибут, если он отсутствует, в элемент XML. Мой XML-файл довольно большой, поэтому я включил его фрагмент:

        <subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
            <buffer-cache name="default"/>
            <server name="default-server">
                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
        </subsystem>

Задача Ansible -

- name: Turn on proxy address forwarding support for http
  xml:
          path: /opt/keycloak-quickstarts-latest/keycloak-server/standalone/configuration/standalone.xml
          xpath: //http-listener
          value: "true"
          attribute: "proxy-address-forwarding"

Моя проблема в том, что приведенная выше задача завершается с Can't process Xpath / in order to spawn nodes!. Я попытался сделать это, используя ansible 2.7.8 и 2.8.1.

1 Ответ

0 голосов
/ 05 июля 2019

Слава @ daniel-haley и @ matthew-l-daniel, сработала следующая задача:

---
          path: /opt/keycloak-quickstarts-latest/keycloak-server/standalone/configuration/standalone.xml
          xpath: //undertow:http-listener
          value: "true"
          attribute: "proxy-address-forwarding"
          namespaces:
                  domain: "urn:jboss:domain:8.0"
                  undertow: "urn:jboss:domain:undertow:7.0"

Не понял раздел пространства имен, хотя я даже пробовал его.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...