KAMI911.tomcat
Ansible Role: Install Apache Tomcat Java Application Server (with Hugepages Option)
This role installs the Apache Tomcat Java application server. It provides a comprehensive Tomcat setup with features like init.d script, custom app names, hugepages support, security hardening, user-friendly error pages, secure passwords, JMX configuration, and support for multiple Tomcat versions, with separate directories for catalina_home and catalina_base.
Table of Contents
- Requirements
- Installation
- Role Variables
- Dependencies
- Example Playbook
- Licensing
- Author Information
- Support
- Contributing
- Donation
Requirements
No special requirements.
Installation
Run the following command to install the role:
ansible-galaxy install kami911.tomcat
Role Variables
Here are the available configuration options along with their default settings (see defaults/main.yml
):
Installation Options
- tomcat_manage_java_pkg: Set to
False
to allow Tomcat to manage Java itself. - tomcat_installer_force_download: Set to
true
to always download the installation file. - tomcat_download_mirror: URL to download the installation file.
- tomcat_download_url: Full URL for downloading the Tomcat installation file.
- tomcat_installer_force_overwrite: Set to
true
to overwrite any existing installation files. - tomcat_installer_keep: Set to
true
to keep the installer after installation. - tomcat_installer_local: Set to
false
to download the installation file directly to the Ansible host. - tomcat_download_validate_certs: Set to
false
to skip certificate validation during download. - tomcat_force_update: Set to
false
to not force updates if the same version is already installed.
Version Options
- tomcat_majorversion: Defines the major version of Tomcat (default:
8
). - tomcat_minorversion: Defines the minor version of Tomcat (default:
5
). - tomcat_patchversion: Defines the patch version of Tomcat (default:
4
). - tomcat_java_version: Specifies the version of Java to use.
Hugepages Options
- tomcat_use_huge_pages: Set to
True
to use Huge Pages, enhancing Java performance.
Network and Firewall Options
- tomcat_manage_firewalld: Set to
true
to manage firewall settings for required ports. - tomcat_enable_firewalld: Set to
false
to disable installation of firewalld service. - tomcat_manage_firewalld_use_zone: Set to
true
to use zones in firewall settings.
Encoding Options
- tomcat_file_encoding: Sets the file encoding (default:
UTF-8
). - tomcat_page_encoding: Sets the page encoding (default:
UTF-8
).
Locale Options
- tomcat_locale_language: Defines the language (default:
en
). - tomcat_locale_country: Sets the country (default:
EN
).
Memory Configuration Options
- tomcat_java_heap_min: Minimum Java Heap size (default:
4096m
). - tomcat_java_heap_max: Maximum Java Heap size (default:
4096m
).
Logging Options
- tomcat_access_log_filename: Default filename for access logs.
- tomcat_juli_logging_format: Format for general Tomcat logs.
Security Options
- tomcat_use_secure_flag: Set to
True
to enforce secure connections. - tomcat_session_http_only: Forces Tomcat to use HTTP-only cookies.
Dependencies
No dependencies required.
Example Playbook
Here’s a simple playbook that uses this role:
- hosts: all
roles:
- tomcat
Licensing
This role and its documentation are licensed under MIT/BSD. You can find the license in the LICENSE file.
Author Information
This role was created by Kálmán Szalai - KAMI from 2016 to 2020.
Support
Feel free to ask questions or report issues here.
Using as a Submodule in an AWX Playbook
Add as a submodule:
git submodule add --force [email protected]:KAMI911/ansible-role-tomcat.git roles/tomcat
Update this submodule:
git submodule update --remote roles/tomcat/
Update all submodules:
git submodule foreach git pull origin master
Contributing
You can help improve this role by submitting patches, testing, reporting bugs, or updating documentation. All contributions are welcome!
Please read more in the contributing chapter.
Fork on GitHub
Add a remote for the upstream repository:
git remote add upstream https://github.com/KAMI911/ansible-role-tomcat.git
Keep your fork updated:
git fetch --all
git pull upstream HEAD
Donation
If you find this role useful, consider making a donation:
Most complete Tomcat installation, supporting init.d script,\ application naming, hugepages, hardening, beautiful error pages,\ sha512 hashed passwords, JMX configuration, multiple Tomcat versions,\ separated catalina_home and caralina_base.
ansible-galaxy install KAMI911.tomcat