pulse-mind.tomcat
Ansible Role pulse-mind.tomcat
This role installs Tomcat 8 or 9 on Ubuntu (16.04 or later), Debian, or CentOS using an archive with systemd.
Requirements
Before using this role, make sure you have Java installed. The role doesn't include Java installation. You need to set the JAVA_HOME
directory in the tomcat_java_home
variable.
Role Variables
tomcat_java_home
: The path to your Java installation. This variable is necessary for the systemd service file.
# Directory where the Java installation files will be downloaded on the remote server
tomcat_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"
# Directory on your local machine where Tomcat installation packages are stored
# Local packages will be used instead of downloading new ones.
tomcat_local_archive_dir: '{{ playbook_dir }}/files'
# Whether to use the local archive files (if available)
# The default value is false
tomcat_use_local_archive: true
# Filename for the Tomcat installation file
tomcat_redis_filename: apache-tomcat-9.0.34.tar.gz
To use local files, place the Tomcat .tgz
file in the ./files/
directory and set these variables:
tomcat_archive_name: "apache-tomcat-9.0.34"
tomcat_use_local_archive: true
tomcat_redis_filename: apache-tomcat-9.0.34.tar.gz
Dependencies
You need to have a working Java installation, like OpenJDK 8.
Installing the Role
Run this command to install the role:
ansible-galaxy install pulse-mind.ansible-role-tomcat
Example Playbook
Here’s an example of how to use this role with variable input:
- hosts: servers
roles:
- { role: pulse-mind.ansible-role-tomcat, tomcat_java_home: /path/to/java/jre }
For help in finding the java_home
location on your server, check this Stack Overflow post.
The Tomcat service is set up in /etc/systemd/system/tomcat.service
.
Testing
This role uses Molecule for testing. To run the tests, use this command:
molecule test
License
MIT / BSD
Install Tomcat on Ubuntu >= 16.04 with systemd
ansible-galaxy install pulse-mind.tomcat