tomcat: compatible with Tomcat7 and Tomcat8

evoadmin-mail
Jérémy Lecour 5 years ago committed by Jérémy Lecour
parent 37f701eb54
commit 02719d93fd
  1. 4
      tomcat/README.md
  2. 0
      tomcat/files/tomcat_jessie.service
  3. 15
      tomcat/files/tomcat_stretch.service
  4. 7
      tomcat/tasks/main.yml
  5. 4
      tomcat/tasks/packages_jessie.yml
  6. 29
      tomcat/tasks/packages_stretch.yml

@ -1,7 +1,7 @@
# tomcat
Install a Tomcat depndancies for multiple tomcat instance.
Install Tomcat and its dependencies for multiple instances.
## Available variables
**tomcat_instance_root:** Root dir for Tomcat instance (default: /srv/tomcat)
**tomcat_instance_root**: Root dir for Tomcat instance (default: /srv/tomcat)

@ -0,0 +1,15 @@
[Unit]
Description=Tomcat %u.
After=network.target
[Service]
WorkingDirectory=%h
Environment="CATALINA_BASE=%h"
EnvironmentFile=%h/conf/env
UMask=0002
ExecStart=/usr/share/tomcat8/bin/startup.sh
ExecStop=/usr/share/tomcat8/bin/shutdown.sh
Type=forking
[Install]
WantedBy=default.target

@ -1,3 +1,8 @@
---
- include: packages.yml
- include: packages_jessie.yml
when: ansible_distribution_release == "jessie"
- include: packages_stretch.yml
when: ansible_distribution_major_version | version_compare('9', '>=')
- include: nagios.yml

@ -1,5 +1,5 @@
---
- name: Install dependancy
- name: Install packages
apt:
name: "{{ item }}"
state: present
@ -18,7 +18,7 @@
- name: Copy systemd unit
copy:
src: 'tomcat.service'
src: 'tomcat_jessie.service'
dest: "/etc/systemd/user/tomcat.service"
mode: "0755"

@ -0,0 +1,29 @@
---
- name: Install packages
apt:
name: "{{ item }}"
state: present
with_items:
- 'tomcat8'
- 'tomcat8-user'
- 'libpam-systemd'
- name: Create tomcat root dir
file:
path: "{{ tomcat_instance_root }}"
state: directory
owner: 'root'
group: 'root'
mode: "0755"
- name: Copy systemd unit
copy:
src: 'tomcat_stretch.service'
dest: "/etc/systemd/user/tomcat.service"
mode: "0755"
- name: Disable default tomcat8 service
service:
name: tomcat8
state: stopped
enabled: false
Loading…
Cancel
Save