salt.modules.tomcat

Support for Tomcat

This module uses the manager webapp to manage Apache tomcat webapps If the manager webapp is not configured some of the functions won't work

The following grains should be set tomcat-manager:

user: admin user name passwd: password

or use pillar: tomcat-manager.user: admin user name tomcat-manager.passwd: password

and also configure a user in the conf/tomcat-users.xml file: <?xml version='1.0' encoding='utf-8'?> <tomcat-users>

<role rolename="manager-script"/> <user username="tomcat" password="tomcat" roles="manager-script"/>

</tomcat-users>

Notes: - More information about tomcat manager: http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html - if you use only this module for deployments you've might want to strict access to the manager only from localhost

  • Tested on:
    JVM Vendor:

    Sun Microsystems Inc.

    JVM Version:

    1.6.0_43-b01

    OS Architecture:

    amd64

    OS Name:

    Linux

    OS Version:

    2.6.32-358.el6.x86_64

    Tomcat Version:

    Apache Tomcat/7.0.37

salt.modules.tomcat.deploy_war(war, context, force='no', url='http://localhost:8080/manager', env='base')

Deploy a war file

war: absolute path to war file (should be accessable by the user running tomcat)
or a path supported by the salt.modules.cp.get_file function

context: the context path to deploy force: set True to deploy the webapp even one is deployed in the context

default: False
url: the url of the server manager webapp
default: http://localhost:8080/manager

env: the environment for war file in used by salt.modules.cp.get_file function

CLI Examples:

cp module
salt '*' tomcat.deploy_war salt://application.war /api
salt '*' tomcat.deploy_war salt://application.war /api no
salt '*' tomcat.deploy_war salt://application.war /api yes http://localhost:8080/manager

minion local file system
salt '*' tomcat.deploy_war /tmp/application.war /api
salt '*' tomcat.deploy_war /tmp/application.war /api no
salt '*' tomcat.deploy_war /tmp/application.war /api yes http://localhost:8080/manager
salt.modules.tomcat.fullversion()

Return all server information from catalina.sh version

CLI Example:

salt '*' tomcat.fullversion
salt.modules.tomcat.ls(url='http://localhost:8080/manager')

list all the deployed webapps

url: the url of the server manager webapp
default: http://localhost:8080/manager

CLI Examples:

salt '*' tomcat.ls
salt '*' tomcat.ls http://localhost:8080/manager
salt.modules.tomcat.reload(app, url='http://localhost:8080/manager')

Reload the webapp

app: the webapp context path url: the url of the server manager webapp

CLI Examples:

salt '*' tomcat.reload /jenkins
salt '*' tomcat.reload /jenkins http://localhost:8080/manager
salt.modules.tomcat.serverinfo(url='http://localhost:8080/manager')

return detailes about the server

url: the url of the server manager webapp
default: http://localhost:8080/manager

CLI Examples:

salt '*' tomcat.serverinfo
salt '*' tomcat.serverinfo http://localhost:8080/manager
salt.modules.tomcat.sessions(app, url='http://localhost:8080/manager')

return the status of the webapp sessions

app: the webapp context path url: the url of the server manager webapp

CLI Examples:

salt '*' tomcat.sessions /jenkins
salt '*' tomcat.sessions /jenkins http://localhost:8080/manager
salt.modules.tomcat.signal(signal=None)

Signals catalina to start, stop, securestart, forcestop.

CLI Example:

salt '*' tomcat.signal start
salt.modules.tomcat.start(app, url='http://localhost:8080/manager')

Start the webapp

app: the webapp context path url: the url of the server manager webapp

CLI Examples:

salt '*' tomcat.start /jenkins
salt '*' tomcat.start /jenkins http://localhost:8080/manager
salt.modules.tomcat.status(url='http://localhost:8080/manager')

Used to test if the tomcat manager is up

url: the url of the server manager webapp
default: http://localhost:8080/manager

CLI Examples:

salt '*' tomcat.status
salt '*' tomcat.status http://localhost:8080/manager
salt.modules.tomcat.status_webapp(app, url='http://localhost:8080/manager')

return the status of the webapp (stopped | running | missing)

app: the webapp context path url: the url of the server manager webapp

CLI Examples:

salt '*' tomcat.status_webapp /jenkins
salt '*' tomcat.status_webapp /jenkins http://localhost:8080/manager
salt.modules.tomcat.stop(app, url='http://localhost:8080/manager')

Stop the webapp

app: the webapp context path url: the url of the server manager webapp

CLI Examples:

salt '*' tomcat.stop /jenkins
salt '*' tomcat.stop /jenkins http://localhost:8080/manager
salt.modules.tomcat.undeploy(app, url='http://localhost:8080/manager')

Undeploy a webapp

app: the webapp context path url: the url of the server manager webapp

CLI Examples:

salt '*' tomcat.undeploy /jenkins
salt '*' tomcat.undeploy /jenkins http://localhost:8080/manager
salt.modules.tomcat.version()

Return server version from catalina.sh version

CLI Example:

salt '*' tomcat.version

Previous topic

salt.modules.tls

Next topic

salt.modules.upstart