diff --git a/defaults/main.yml b/defaults/main.yml index a10eafd..1006293 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,10 +1,10 @@ --- # The tomcat version is set at runtime. It changes from one distribution to the other. -#tomcat_version: 7 +# tomcat_version: 7 # To force a tomcat version set the following variable: # tomcat_fixed_version: 9 tomcat_pkg_state: present -tomcat_service_enabled: True +tomcat_service_enabled: true tomcat_pkgs: - 'tomcat{{ tomcat_version }}' - 'libtomcat{{ tomcat_version }}-java' @@ -19,39 +19,39 @@ tomcat_user: 'tomcat{{ tomcat_version }}' tomcat_max_threads: 200 tomcat_min_heap_size: 2048m -tomcat_permgen_defined: True +tomcat_permgen_defined: true tomcat_heap_size: '{{ tomcat_min_heap_size }}' tomcat_permgen_size: 512m tomcat_file_encoding: 'UTF-8' tomcat_java_opts: "-Xms{{ tomcat_min_heap_size }} -Xmx{{ tomcat_heap_size }}" tomcat_additional_java_8_opts: "-XX:+CrashOnOutOfMemoryError" tomcat_java_gc_opts: "-XX:+UseConcMarkSweepGC" -#tomcat_other_java_opts: "-Djsse.enableSNIExtension=false" -tomcat_proxy_enabled: False +# tomcat_other_java_opts: "-Djsse.enableSNIExtension=false" +tomcat_proxy_enabled: false tomcat_proxy_http_host: 'localhost' tomcat_proxy_http_port: '3128' tomcat_proxy_https_host: '{{ tomcat_proxy_http_host }}' tomcat_proxy_https_port: '{{ tomcat_proxy_http_port }}' tomcat_proxy_opts: "-DproxySet=true -Dhttp.proxyHost={{ tomcat_proxy_http_host }} -Dhttp.proxyPort={{ tomcat_proxy_http_port }} -Dhttps.proxyHost={{ tomcat_proxy_https_host }} -Dhttps.proxyPort={{ tomcat_proxy_https_port }}" tomcat_other_java_opts: "" -tomcat_install_server_xml: True -tomcat_install_default_conf: True -tomcat_load_additional_default_conf: True -tomcat_http_enabled: True +tomcat_install_server_xml: true +tomcat_install_default_conf: true +tomcat_load_additional_default_conf: true +tomcat_http_enabled: true tomcat_http_port: 8080 tomcat_http_address: 0.0.0.0 -tomcat_webapps_autodeploy: False -tomcat_webapps_unpack: False -tomcat_ajp_enabled: False +tomcat_webapps_autodeploy: false +tomcat_webapps_unpack: false +tomcat_ajp_enabled: false tomcat_ajp_port: 8009 tomcat_ajp_address: 127.0.0.1 -tomcat_direct_access: False -tomcat_reverse_proxy_name_enabled: False +tomcat_direct_access: false +tomcat_reverse_proxy_name_enabled: false tomcat_reverse_proxy_name: '{{ ansible_fqdn }}' tomcat_reverse_proxy_port: '{{ http_port | default(80) }}' # There is a bug that kills tomcat after 50 days if the shutdown port is enabled # Disable the shutdown port by default -#tomcat_shutdown_port: 8005 +# tomcat_shutdown_port: 8005 tomcat_shutdown_port: -1 tomcat_shutdown_pwd: "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits') }}" tomcat_restart_timeout: 300 @@ -63,43 +63,45 @@ tomcat_webapps_dir: '{{ tomcat_catalina_base_dir }}/webapps' tomcat_common_dir: '{{ tomcat_catalina_base_dir }}/common/' tomcat_common_classes_dir: '{{ tomcat_catalina_base_dir }}/common/classes' tomcat_tmp_dir: '{{ tomcat_catalina_base_dir }}/tmp/tomcat' +tomcat_enable_catalina_shared_loader: true + # JMX and debugging -tomcat_enable_remote_debugging: False +tomcat_enable_remote_debugging: false tomcat_remote_debugging_host: '0.0.0.0' tomcat_remote_debugging_port: ':8100' tomcat_remote_debugging_uri: '{{ tomcat_remote_debugging_host }}:{{ tomcat_remote_debugging_port }}' # -tomcat_jmx_enabled: False -tomcat_jmx_auth_enabled: False +tomcat_jmx_enabled: false +tomcat_jmx_auth_enabled: false tomcat_jmx_port: 8082 tomcat_jmx_auth_dir: '{{ tomcat_conf_dir }}' -tomcat_jmx_use_ssl: False +tomcat_jmx_use_ssl: false # The following work with jdk >= 7.0.25 only -tomcat_jmx_disable_additional_ports: True -tomcat_jmx_localhost_only: False +tomcat_jmx_disable_additional_ports: true +tomcat_jmx_localhost_only: false # tomcat_jmx_monitorpass: define_in_a_vault_file # tomcat_jmx_controlpass: define_in_a_vault_file # Metrics monitoring via javamelody -tomcat_javamelody: False -#tomcat_javamelody_version: latest +tomcat_javamelody: false +# tomcat_javamelody_version: latest tomcat_javamelody_version: 1.82.0 # tomcat logging tomcat_logdir: '/var/log/tomcat{{ tomcat_version }}' -tomcat_use_log4j: True -tomcat_install_the_log4j_properties: True +tomcat_use_log4j: true +tomcat_install_the_log4j_properties: true tomcat_retain_old_logs: 30 tomcat_log_rotation_threshold: "ALL" tomcat_log_max_file_size: "100MB" tomcat_log_level: INFO tomcat_log_logger: CATALINA -tomcat_access_log_enabled: True +tomcat_access_log_enabled: true tomcat_access_log_rotation_freq: "daily" # # Define them if you want to send all the logs to an ELK installation -tomcat_send_to_logstash: False +tomcat_send_to_logstash: false tomcat_logstash_collector_host: logstash tomcat_logstash_collector_socketappender_port: 4560 tomcat_logstash_collector_socketappender_reconndelay: 10000 @@ -107,29 +109,28 @@ tomcat_logstash_collector_socketappender_reconndelay: 10000 tomcat_logstash_logger: CATALINA, LOGSTASH -#tomcat_access_log_file_name: localhost_access.log +# tomcat_access_log_file_name: localhost_access.log # # Administrative interface -tomcat_install_admin: False -tomcat_manager_gui_user_enabled: True +tomcat_install_admin: false +tomcat_manager_gui_user_enabled: true tomcat_manager_gui_user: guiadmin tomcat_manager_gui_r: "manager-gui" -#tomcat_manager_gui_pwd: *See the vault file* -tomcat_manager_script_user_enabled: False +# tomcat_manager_gui_pwd: *See the vault file* +tomcat_manager_script_user_enabled: false tomcat_manager_script_user: scriptadmin tomcat_manager_script_r: "manager-script" -#tomcat_manager_script_pwd: *See the vault file* -tomcat_manager_jmx_user_enabled: False +# tomcat_manager_script_pwd: *See the vault file* +tomcat_manager_jmx_user_enabled: false tomcat_manager_jmx_user: jmxadmin tomcat_manager_jmx_r: "manager-jmx" -#tomcat_manager_jmx_pwd: *See the vault file* -tomcat_manager_status_user_enabled: False +# tomcat_manager_jmx_pwd: *See the vault file* +tomcat_manager_status_user_enabled: false tomcat_manager_status_user: statusadmin tomcat_manager_status_r: "manager-status" -#tomcat_manager_status_pwd: *See the vault file* +# tomcat_manager_status_pwd: *See the vault file* # -tomcat_install_jdbc: False +tomcat_install_jdbc: false tomcat_install_pg_jdbc: '{{ tomcat_install_jdbc }}' # Not used yet -tomcat_install_mysql_jdbc: False - +tomcat_install_mysql_jdbc: false diff --git a/tasks/main.yml b/tasks/main.yml index 9528177..a676009 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,12 +7,12 @@ when: - tomcat_jmx_enabled - tomcat_jmx_auth_enabled - tags: [ 'tomcat', 'jmx' ] + tags: ['tomcat', 'jmx'] - import_tasks: tomcat-log4j-logging.yml when: - tomcat_use_log4j - tomcat_version <= 7 - tags: [ 'tomcat', 'tomcat_log4j' ] + tags: ['tomcat', 'tomcat_log4j'] - import_tasks: tomcat-logger-logging.yml when: not tomcat_use_log4j or tomcat_version > 7 - import_tasks: access_log.yml @@ -21,5 +21,3 @@ when: tomcat_install_pg_jdbc - import_tasks: not_pgsql_jdbc.yml when: not tomcat_install_pg_jdbc - - diff --git a/tasks/tomcat-pkgs.yml b/tasks/tomcat-pkgs.yml index 9e9b11d..e1f3c74 100644 --- a/tasks/tomcat-pkgs.yml +++ b/tasks/tomcat-pkgs.yml @@ -64,7 +64,7 @@ tags: [ 'tomcat', 'tomcat_serverxml', 'tomcat_conf' ] - name: Install a slightly modified catalina.properties - copy: src=catalina.properties dest={{ tomcat_conf_dir }}/catalina.properties owner=root group={{ tomcat_user }} mode=0644 + template: src=catalina.properties.j2 dest={{ tomcat_conf_dir }}/catalina.properties owner=root group={{ tomcat_user }} mode=0644 when: tomcat_install_default_conf | bool notify: tomcat restart tags: [ 'tomcat', 'tomcat_catalinaprops' ] @@ -83,4 +83,3 @@ - commons-daemon.jar when: tomcat_version >= 8 tags: [ 'tomcat', 'tomcat_conf' ] - diff --git a/files/catalina.properties b/templates/catalina.properties.j2 similarity index 96% rename from files/catalina.properties rename to templates/catalina.properties.j2 index c57b4e8..02249e3 100644 --- a/files/catalina.properties +++ b/templates/catalina.properties.j2 @@ -37,7 +37,7 @@ package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache # List of comma-separated paths defining the contents of the "common" # classloader. Prefixes should be used to define what is the repository type. # Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. -# If left as blank,the JVM system loader will be used as Catalina's "common" +# If left as blank,the JVM system loader will be used as Catalina s "common" # loader. # Examples: # "foo": Add this folder as a class repository @@ -50,7 +50,7 @@ common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/l # List of comma-separated paths defining the contents of the "server" # classloader. Prefixes should be used to define what is the repository type. # Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. -# If left as blank, the "common" loader will be used as Catalina's "server" +# If left as blank, the "common" loader will be used as Catalina s "server" # loader. # Examples: # "foo": Add this folder as a class repository @@ -59,11 +59,12 @@ common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/l # "foo/bar.jar": Add bar.jar as a class repository server.loader=${catalina.home}/server/classes,${catalina.home}/server/*.jar,${catalina.base}/server/classes,${catalina.base}/server/*.jar +{% if tomcat_enable_catalina_shared_loader %} # # List of comma-separated paths defining the contents of the "shared" # classloader. Prefixes should be used to define what is the repository type. # Path may be relative to the CATALINA_BASE path or absolute. If left as blank, -# the "common" loader will be used as Catalina's "shared" loader. +# the "common" loader will be used as Catalina s "shared" loader. # Examples: # "foo": Add this folder as a class repository # "foo/*.jar": Add all the JARs of the specified folder as class @@ -71,7 +72,8 @@ server.loader=${catalina.home}/server/classes,${catalina.home}/server/*.jar,${ca # "foo/bar.jar": Add bar.jar as a class repository # Please note that for single jars, e.g. bar.jar, you need the URL form # starting with file:. -shared.loader=${catalina.home}/shared/classes,${catalina.home}/shared/*.jar,${catalina.base}/shared/classes,${catalina.base}/shared/*.jar +shared.loader={{ tomcat_catalina_shared_loader_path }} +{% endif %} # List of JAR files that should not be scanned using the JarScanner # functionality. This is typically used to scan JARs for configuration