tomcat: compatible with Tomcat7 and Tomcat8

This commit is contained in:
Jérémy Lecour 2017-12-08 10:33:33 +01:00 committed by Jérémy Lecour
parent 37f701eb54
commit 02719d93fd
6 changed files with 54 additions and 5 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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