Merge branch 'master' of adellam/ansible-roles into master

This commit is contained in:
Andrea Dell'Amico 2019-08-14 18:47:23 +02:00 committed by Gitea
commit ac1cc20f9d
9 changed files with 8653 additions and 10 deletions

View File

@ -48,6 +48,7 @@ tomcat_m_restart_timeout: 300
# -server -Djava.awt.headless=true are always used. No need to specify them
tomcat_m_java_opts_heap: "-Xms{{ tomcat_m_min_heap_size }} -Xmx{{ tomcat_m_heap_size }}"
tomcat_m_java_opts_permgen: "-XX:MaxPermSize={{ tomcat_m_permgen_size }}"
tomcat_m_additional_java_8_opts: "-XX:+CrashOnOutOfMemoryError"
tomcat_m_java_opts: ""
tomcat_m_java_gc_opts: "-XX:+UseConcMarkSweepGC"
# Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved

View File

@ -66,7 +66,7 @@
copy: src={{ item[1] }} dest={{ item.0.instance_path }}/conf/{{ item[1] }} owner={{ item.0.user }} group={{ item.0.user }} mode=0640
with_nested:
- '{{ tomcat_m_instances }}'
- [ 'context.xml', 'web.xml' ]
- [ 'context.xml' ]
register: restart_needed
notify:
- tomcat restart instances with changed configs
@ -113,9 +113,16 @@
- tomcat restart instances with changed configs
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_serverxml' ]
- name: Install the web.xml file
template: src=tomcat-web.xml.j2 dest={{ item.instance_path }}/conf/web.xml owner={{ item.user }} group={{ item.user }} mode=0640
with_items: '{{ tomcat_m_instances }}'
register: restart_needed
notify:
- tomcat restart instances with changed configs
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_serverxml' ]
- name: Install the tomcat-admin package if the host-manager or manager apps are required
apt: pkg={{ item }} state={{ tomcat_pkg_state }} cache_valid_time=1800 update_cache=yes
with_items: 'tomcat{{ tomcat_version }}-admin'
apt: pkg=tomcat{{ tomcat_version }}-admin state={{ tomcat_pkg_state }} cache_valid_time=1800 update_cache=yes
when: tomcat_m_host_manager_install or tomcat_m_manager_install
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager', 'tomcat_manager' ]

View File

@ -6,6 +6,10 @@ TOMCAT_USER={{ item.user }}
TOMCAT_GROUP={{ item.user }}
JAVA_HOME={{ item.java_home }}
JAVA_OPTS="-server -Djava.awt.headless=true -Dfile.encoding={{ tomcat_m_file_encoding }}"
{% if jdk_default >= 8 %}
JAVA_OPTS="{{ tomcat_m_additional_java_8_opts }} $JAVA_OPTS"
{% endif %}
{% if item.java_heap is defined %}
JAVA_HEAP="{{ item.java_heap }}"
{% else %}

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,11 @@ tomcat_pkgs:
- 'libtomcat{{ tomcat_version }}-java'
- 'tomcat{{ tomcat_version }}-common'
- libapr1
tomcat8_additional_pkgs:
- jsvc
- libcommons-daemon-java
tomcat_user: 'tomcat{{ tomcat_version }}'
tomcat_max_threads: 200
@ -19,6 +24,7 @@ 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_other_java_opts: ""
@ -69,6 +75,9 @@ 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: True
# tomcat logging
tomcat_logdir: '/var/log/tomcat{{ tomcat_version }}'
tomcat_use_log4j: True

View File

@ -1,9 +1,7 @@
---
# Postgresql JDBC
- name: Install the jdbc package if needed
apt: pkg={{ item }} state=present
with_items:
- libpostgresql-jdbc-java
apt: pkg=libpostgresql-jdbc-java state=present
when: tomcat_install_pg_jdbc
tags: [ 'tomcat', 'tomcat_jdbc' ]

View File

@ -5,7 +5,7 @@
when:
- ansible_distribution_major_version <= '16'
- tomcat_fixed_version is not defined
tags: tomcat
tags: [ 'tomcat', 'tomcat_ver' ]
- name: Set the tomcat version for Ubuntu bionic
set_fact:
@ -13,18 +13,23 @@
when:
- ansible_distribution_major_version == '18'
- tomcat_fixed_version is not defined
tags: tomcat
tags: [ 'tomcat', 'tomcat_ver' ]
- name: Impose a tomcat version
set_fact:
tomcat_version: '{{ tomcat_fixed_version }}'
when: tomcat_fixed_version is defined
tags: tomcat
tags: [ 'tomcat', 'tomcat_ver' ]
- name: Install the tomcat packages
apt: pkg={{ tomcat_pkgs }} state={{ tomcat_pkg_state }}
apt: pkg={{ tomcat_pkgs }} state={{ tomcat_pkg_state }} cache_valid_time=1800
tags: tomcat
- name: Install additional packages needed by tomcat 8+
apt: pkg={{ tomcat8_additional_pkgs }} state={{ tomcat_pkg_state }} cache_valid_time=1800
when: tomcat_version >= 8
tags: [ 'tomcat', 'tomcat_javamelody' ]
- name: Create the tomcat tmp directory
file: dest={{ tomcat_tmp_dir }} state=directory owner={{ tomcat_user }} group={{ tomcat_user }}
notify: tomcat restart
@ -48,6 +53,11 @@
notify: tomcat restart
tags: [ 'tomcat', 'tomcat_serverxml' ]
- name: Configure tomcat web.xml
template: src=tomcat-web.xml.j2 dest={{ tomcat_conf_dir }}/web.xml
notify: tomcat restart
tags: [ 'tomcat', 'tomcat_serverxml' ]
- name: Install a slightly modified catalina.properties
copy: src=catalina.properties dest={{ tomcat_conf_dir }}/catalina.properties owner=root group={{ tomcat_user }} mode=0644
when: tomcat_install_default_conf
@ -61,3 +71,20 @@
- server/classes
- shared/classes
tags: tomcat
- name: On tomcat8, create a link to commons-daemon.jar to avoid exceptions at startup
file: src=/usr/share/java/{{ item }} dest={{ tomcat_catalina_home_dir }}/bin/{{ item }} state=link owner=root group=root mode=0644
with_items:
- commons-daemon.jar
when: tomcat_version >= 8
tags: [ 'tomcat', 'tomcat_javamelody' ]
- name: Install the javamelody war if the javamelody support is enabled
maven_artifact: artifact_id=javamelody-core version=latest group_id=net.bull.javamelody extension=jar dest={{ tomcat_catalina_home_dir }}/lib/javamelody-core.jar verify_checksum=always mode=0644 owner=root group=root
when: tomcat_javamelody
tags: [ 'tomcat', 'tomcat_javamelody' ]
- name: Remove the javamelody war if the javamelody support is disabled
file: dest={{ tomcat_catalina_home_dir }}/lib/javamelody-core.jar state=absent
when: not tomcat_javamelody
tags: [ 'tomcat', 'tomcat_javamelody' ]

View File

@ -26,6 +26,9 @@ JAVA_OPTS="-XX:MaxPermSize={{ tomcat_permgen_size }} $JAVA_OPTS"
{% endif %}
{% endif %}
{% endif %}
{% if jdk_default >= 8 %}
JAVA_OPTS="{{ tomcat_additional_java_8_opts }} $JAVA_OPTS"
{% endif %}
{% if tomcat_java_opts is defined %}
JAVA_OPTS="{{ tomcat_java_opts }} $JAVA_OPTS"
{% endif %}

File diff suppressed because it is too large Load Diff