Hello every one,
I’m working with Ansible to manipulate and make automation to tomcat server events,
My objective is to update the tomcat server port , the default port is 8080,
The port number is in the “server.xml”,
The path is “/Server/Service/Connector”
But the problem is that i have two connector in the “server.xml” file
So it’s hard to identify with port to update for Ansible.
The file looks like this :
I want to update the “8080” port not the “9080”,
Thank you for your help.
Unless you are planning on updating your tomcat version very frequently, it might be simpler to use template
module to substitute in the port number. We have a few other custom changes in our server.xml so it made sense for us. I’d recommend keeping the unmodified server.xml around in your ansible role somewhere so that you have something to compare to when you do eventually update your tomcat version.
If you still want to manipulate the xml you can probably pick it out using an attribute like this
/Server/Service/Connector[@protocol="HTTP/1.1"]
Hope this helps,
Jon