Ansible XML 配置 Jira Server.xml
Ansible XML to configure Jira Server.xml
目前,我正在尝试使用 ansible 来更改我的“server.xml”文件中的字段。具体来说,“连接器”元素中列出的选项。我已经发布了我的“server.xml”示例,其中更改了字段内容以删除识别信息。
<?xml version="1.0" encoding="utf-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<Service name="Catalina">
<Connector port="8080" proxyName="test.somewebsite.com" proxyport="443" scheme="https" secure="true" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^\`"<>"
maxThreads="150" minSpareThreads="25" connectionTimeout="20000" enableLookups="false"
maxHttpHeaderSize="8192" protocol="HTTP/1.1" useBodyEncodingForURI="true" redirectPort="8443"
acceptCount="100" disableUploadTimeout="true" bindOnInit="false"/>
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
<Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
<Manager pathname=""/>
<JarScanner scanManifest="false"/>
</Context>
</Host>
<Valve className="org.apache.catalina.valves.AccessLogValve"
pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r""/>
</Engine>
</Service>
我正在使用以下 Ansible 进行更改。我的大部分调整将在连接器属性上执行,例如更改代理名称或将其完全删除。不幸的是,我发现唯一类似的是命名空间,但是这段代码没有使用传统的命名空间。我做错了什么?
- hosts: localhost
tasks:
- name: Update Scheme Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector/@scheme
value: https
- name: Update Secure Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector/@secure
value: true
- name: Remove the Unused attributes
xml:
path: /home/test/server.xml
xpath: "{{ item }}"
state: absent
loop:
- "/Server/Service/Connector/@proxyName"
- "/Server/Service/Connector/@proxyport"
- "/Server/Service/Connector/@secure"
- "/Server/Service/Connector/@redirectPort"
按照documentation, you must provide the attribute name in the separate attribute
option when using value
来设置。另请注意,必须引用 true
值,否则您将收到 python 错误,抱怨您传递的是 bool 而不是 string
这是你的固定任务集:
tasks:
- name: Update Scheme Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector
attribute: scheme
value: https
- name: Update Secure Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector
attribute: secure
value: "true"
- name: Remove the Unused attributes
xml:
path: /home/test/server.xml
xpath: "{{ item }}"
state: absent
loop:
- "/Server/Service/Connector/@proxyName"
- "/Server/Service/Connector/@proxyport"
- "/Server/Service/Connector/@secure"
- "/Server/Service/Connector/@redirectPort"
目前,我正在尝试使用 ansible 来更改我的“server.xml”文件中的字段。具体来说,“连接器”元素中列出的选项。我已经发布了我的“server.xml”示例,其中更改了字段内容以删除识别信息。
<?xml version="1.0" encoding="utf-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<Service name="Catalina">
<Connector port="8080" proxyName="test.somewebsite.com" proxyport="443" scheme="https" secure="true" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^\`"<>"
maxThreads="150" minSpareThreads="25" connectionTimeout="20000" enableLookups="false"
maxHttpHeaderSize="8192" protocol="HTTP/1.1" useBodyEncodingForURI="true" redirectPort="8443"
acceptCount="100" disableUploadTimeout="true" bindOnInit="false"/>
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
<Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
<Manager pathname=""/>
<JarScanner scanManifest="false"/>
</Context>
</Host>
<Valve className="org.apache.catalina.valves.AccessLogValve"
pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r""/>
</Engine>
</Service>
我正在使用以下 Ansible 进行更改。我的大部分调整将在连接器属性上执行,例如更改代理名称或将其完全删除。不幸的是,我发现唯一类似的是命名空间,但是这段代码没有使用传统的命名空间。我做错了什么?
- hosts: localhost
tasks:
- name: Update Scheme Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector/@scheme
value: https
- name: Update Secure Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector/@secure
value: true
- name: Remove the Unused attributes
xml:
path: /home/test/server.xml
xpath: "{{ item }}"
state: absent
loop:
- "/Server/Service/Connector/@proxyName"
- "/Server/Service/Connector/@proxyport"
- "/Server/Service/Connector/@secure"
- "/Server/Service/Connector/@redirectPort"
按照documentation, you must provide the attribute name in the separate attribute
option when using value
来设置。另请注意,必须引用 true
值,否则您将收到 python 错误,抱怨您传递的是 bool 而不是 string
这是你的固定任务集:
tasks:
- name: Update Scheme Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector
attribute: scheme
value: https
- name: Update Secure Option in Connector
xml:
path: /home/test/server.xml
xpath: /Server/Service/Connector
attribute: secure
value: "true"
- name: Remove the Unused attributes
xml:
path: /home/test/server.xml
xpath: "{{ item }}"
state: absent
loop:
- "/Server/Service/Connector/@proxyName"
- "/Server/Service/Connector/@proxyport"
- "/Server/Service/Connector/@secure"
- "/Server/Service/Connector/@redirectPort"