tomcat: add tags so that we set tomcat_version when we use tomcat_conf or tomcat_javamelody.
This commit is contained in:
parent
a5c523bb4c
commit
973faadfe2
|
@ -11,7 +11,7 @@
|
|||
user: name={{ item.user }} home={{ item.user_home }} createhome=false shell={{ item.user_shell | default('/bin/false') }}
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
when:
|
||||
- not tomcat_m_use_default_user
|
||||
- not tomcat_m_use_default_user | bool
|
||||
- item.user != "tomcat{{ tomcat_version }}"
|
||||
register: tomcat_first_install
|
||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||
|
@ -19,7 +19,7 @@
|
|||
- name: Create a tomcat user if needed
|
||||
user: name={{ tomcat_m_default_user }} home={{ tomcat_m_instances_base_path }} createhome=false shell={{ tomcat_m_default_user_shell }}
|
||||
when:
|
||||
- tomcat_m_use_default_user
|
||||
- tomcat_m_use_default_user | bool
|
||||
- tomcat_m_default_user != "tomcat{{ tomcat_version }}"
|
||||
register: tomcat_first_install
|
||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||
|
@ -68,8 +68,7 @@
|
|||
- '{{ tomcat_m_instances }}'
|
||||
- [ 'context.xml' ]
|
||||
register: restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
notify: tomcat restart instances with changed configs
|
||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||
|
||||
- name: Install catalina.properties
|
||||
|
@ -78,8 +77,7 @@
|
|||
- '{{ tomcat_m_instances }}'
|
||||
- [ 'catalina.properties' ]
|
||||
register: restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
notify: tomcat restart instances with changed configs
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_catalina_properties' ]
|
||||
|
||||
- name: Populate the instances conf/policy.d directory
|
||||
|
@ -88,8 +86,7 @@
|
|||
- '{{ tomcat_m_instances }}'
|
||||
- [ '01system.policy', '02debian.policy', '03catalina.policy', '04webapps.policy', '50local.policy' ]
|
||||
register: restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
notify: tomcat restart instances with changed configs
|
||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||
|
||||
- name: Install logging.properties if we do not use log4j for the tomcat logging
|
||||
|
@ -99,57 +96,51 @@
|
|||
- [ 'logging.properties' ]
|
||||
when:
|
||||
- tomcat_use_log4j is defined
|
||||
- not tomcat_use_log4j
|
||||
- not tomcat_use_log4j | bool
|
||||
register: restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
notify: tomcat restart instances with changed configs
|
||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||
|
||||
- name: Install the server.xml conf file
|
||||
template: src=tomcat-server.xml.j2 dest={{ item.instance_path }}/conf/server.xml owner={{ item.user }} group={{ item.user }} mode=0640
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
register: restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
notify: 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
|
||||
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=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
|
||||
when: tomcat_m_host_manager_install | bool or tomcat_m_manager_install | bool
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager', 'tomcat_manager' ]
|
||||
|
||||
- name: Install the catalina configuration for the tomcat manager
|
||||
template: src=tomcat-manager.xml.j2 dest={{ item.instance_path }}/conf/Catalina/localhost/manager.xml owner={{ item.user }} group={{ item.user }} mode=0640
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
register: restart_needed
|
||||
when: tomcat_m_manager_install
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
when: tomcat_m_manager_install | bool
|
||||
notify: tomcat restart instances with changed configs
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_manager' ]
|
||||
|
||||
- name: Install the catalina configuration for the tomcat host manager
|
||||
template: src=tomcat-host-manager.xml.j2 dest={{ item.instance_path }}/conf/Catalina/localhost/host-manager.xml owner={{ item.user }} group={{ item.user }} mode=0640
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
register: restart_needed
|
||||
when: tomcat_m_host_manager_install
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
when: tomcat_m_host_manager_install | bool
|
||||
notify: tomcat restart instances with changed configs
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager' ]
|
||||
|
||||
- name: Install the catalina configuration for the tomcat manager
|
||||
template: src=tomcat-users.xml.j2 dest={{ item.instance_path }}/conf/tomcat-users.xml owner={{ item.user }} group={{ item.user }} mode=0640
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
register: restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
notify: tomcat restart instances with changed configs
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager', 'tomcat_manager' ]
|
||||
|
||||
- name: Install the instances startup scripts
|
||||
|
@ -166,15 +157,16 @@
|
|||
|
||||
- name: Reload the systemd daemon if we are running on a systemd-backed server
|
||||
command: systemctl daemon-reload
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
when:
|
||||
- ansible_service_mgr == 'systemd'
|
||||
- reload_systemd | bool
|
||||
|
||||
- name: Install a custom context.xml file
|
||||
template: src=tomcat-context.xml.j2 dest={{ item.instance_path }}/conf/context.xml owner={{ item.user }} group={{ item.user }} mode=0640
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
register: restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed configs
|
||||
when: tomcat_m_jndi_pool
|
||||
notify: tomcat restart instances with changed configs
|
||||
when: tomcat_m_jndi_pool | bool
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_contextxml', 'jdk' ]
|
||||
|
||||
- name: Install a logrotate entry for the access log file
|
||||
|
@ -188,11 +180,10 @@
|
|||
when:
|
||||
- item.jmx_enabled is defined
|
||||
- item.jmx_auth_enabled is defined
|
||||
- item.jmx_enabled
|
||||
- item.jmx_auth_enabled
|
||||
- item.jmx_enabled | bool
|
||||
- item.jmx_auth_enabled | bool
|
||||
register: jmx_restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed jmx config
|
||||
notify: tomcat restart instances with changed jmx config
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_jmx' ]
|
||||
|
||||
- name: Install the jmx role file
|
||||
|
@ -201,24 +192,23 @@
|
|||
when:
|
||||
- item.jmx_enabled is defined
|
||||
- item.jmx_auth_enabled is defined
|
||||
- item.jmx_enabled
|
||||
- item.jmx_auth_enabled
|
||||
register: jmx restart_needed
|
||||
notify:
|
||||
- tomcat restart instances with changed jmx config
|
||||
- item.jmx_enabled | bool
|
||||
- item.jmx_auth_enabled | bool
|
||||
register: jmx_restart_needed
|
||||
notify: tomcat restart instances with changed jmx config
|
||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_jmx' ]
|
||||
|
||||
- name: Start all the tomcat instances
|
||||
service: name='tomcat-instance-{{ item.http_port }}' state=started sleep=20
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
when:
|
||||
- tomcat_first_install.changed
|
||||
- tomcat_m_start_instances
|
||||
- tomcat_first_install.changed | bool
|
||||
- tomcat_m_start_instances | bool
|
||||
tags: [ 'tomcat', 'tomcat_instances']
|
||||
ignore_errors: True
|
||||
|
||||
- name: Enable all the tomcat instances
|
||||
service: name='tomcat-instance-{{ item.http_port }}' enabled=yes
|
||||
with_items: '{{ tomcat_m_instances }}'
|
||||
when: tomcat_m_enable_instances
|
||||
when: tomcat_m_enable_instances | bool
|
||||
tags: [ 'tomcat', 'tomcat_instances']
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
when:
|
||||
- ansible_distribution_major_version <= '16'
|
||||
- tomcat_fixed_version is not defined
|
||||
tags: [ 'tomcat', 'tomcat_ver' ]
|
||||
tags: [ 'tomcat', 'tomcat_ver', 'tomcat_conf', 'tomcat_javamelody' ]
|
||||
|
||||
- name: Set the tomcat version for Ubuntu bionic
|
||||
set_fact:
|
||||
|
@ -13,13 +13,18 @@
|
|||
when:
|
||||
- ansible_distribution_major_version == '18'
|
||||
- tomcat_fixed_version is not defined
|
||||
tags: [ 'tomcat', 'tomcat_ver' ]
|
||||
tags: [ 'tomcat', 'tomcat_ver', 'tomcat_conf', 'tomcat_javamelody' ]
|
||||
|
||||
- name: Impose a tomcat version
|
||||
set_fact:
|
||||
tomcat_version: '{{ tomcat_fixed_version }}'
|
||||
when: tomcat_fixed_version is defined
|
||||
tags: [ 'tomcat', 'tomcat_ver' ]
|
||||
tags: [ 'tomcat', 'tomcat_ver', 'tomcat_conf', 'tomcat_javamelody' ]
|
||||
|
||||
- name: Print the Tomcat version
|
||||
debug:
|
||||
msg: "The Tomcat version we are going to install is {{ tomcat_version }}"
|
||||
tags: [ 'tomcat', 'tomcat_ver', 'tomcat_conf', 'tomcat_javamelody' ]
|
||||
|
||||
- name: Install the tomcat packages
|
||||
apt: pkg={{ tomcat_pkgs }} state={{ tomcat_pkg_state }} cache_valid_time=1800
|
||||
|
@ -28,7 +33,7 @@
|
|||
- 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' ]
|
||||
tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf', 'tomcat_javamelody' ]
|
||||
|
||||
- name: Create the tomcat tmp directory
|
||||
file: dest={{ tomcat_tmp_dir }} state=directory owner={{ tomcat_user }} group={{ tomcat_user }}
|
||||
|
@ -77,17 +82,17 @@
|
|||
with_items:
|
||||
- commons-daemon.jar
|
||||
when: tomcat_version >= 8
|
||||
tags: [ 'tomcat', 'tomcat_javamelody' ]
|
||||
tags: [ 'tomcat', 'tomcat_conf' ]
|
||||
|
||||
- name: Install the javamelody dependency jar into the Java shared libs directory
|
||||
maven_artifact: artifact_id=jrobin version=latest group_id=org.jrobin extension=jar dest=/usr/share/java/jrobin.jar verify_checksum=always mode=0644 owner=root group=root repository_url=https://repo1.maven.org/maven2
|
||||
when: tomcat_javamelody | bool
|
||||
tags: [ 'tomcat', 'tomcat_javamelody' ]
|
||||
tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ]
|
||||
|
||||
- name: Install the javamelody-core jar into the Java shared libs directory
|
||||
maven_artifact: artifact_id=javamelody-core version={{ tomcat_javamelody_version }} group_id=net.bull.javamelody extension=jar dest=/usr/share/java/javamelody-core.jar verify_checksum=always mode=0644 owner=root group=root repository_url=https://repo1.maven.org/maven2
|
||||
when: tomcat_javamelody | bool
|
||||
tags: [ 'tomcat', 'tomcat_javamelody' ]
|
||||
tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ]
|
||||
|
||||
- name: Create a link to the the javamelody jar and its dependencies if the javamelody support is enabled
|
||||
file: src=../../java/{{ item }} dest={{ tomcat_catalina_home_dir }}/lib/{{ item }} state=link owner=root group=root mode=0644
|
||||
|
@ -95,7 +100,7 @@
|
|||
- javamelody-core.jar
|
||||
- jrobin.jar
|
||||
when: tomcat_javamelody | bool
|
||||
tags: [ 'tomcat', 'tomcat_javamelody' ]
|
||||
tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ]
|
||||
|
||||
- name: Remove the javamelody jar and its dependencies if the javamelody support is disabled
|
||||
file: dest={{ tomcat_catalina_home_dir }}/lib/{{ item }} state=absent
|
||||
|
@ -103,4 +108,4 @@
|
|||
- javamelody-core.jar
|
||||
- jrobin.jar
|
||||
when: not tomcat_javamelody | bool
|
||||
tags: [ 'tomcat', 'tomcat_javamelody' ]
|
||||
tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ]
|
||||
|
|
Loading…
Reference in New Issue