Fix the restart sequence.
This commit is contained in:
parent
2289cbc9aa
commit
c13b556fc8
|
@ -40,7 +40,8 @@ tomcat_m_shutdown_port: -1
|
||||||
tomcat_m_shutdown_pwd: "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits,hexdigits,punctuation') }}"
|
tomcat_m_shutdown_pwd: "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits,hexdigits,punctuation') }}"
|
||||||
tomcat_m_max_threads: 200
|
tomcat_m_max_threads: 200
|
||||||
tomcat_m_min_heap_size: 2048m
|
tomcat_m_min_heap_size: 2048m
|
||||||
tomcat_m_heap_size: '{{ tomcat_m_min_heap_size }}'
|
catalina_tomcat_m_heap_size: '{{ tomcat_m_min_heap_size }}'
|
||||||
|
tomcat_m_heap_size: '{{ catalina_tomcat_m_heap_size }}'
|
||||||
tomcat_m_permgen_size: 512m
|
tomcat_m_permgen_size: 512m
|
||||||
tomcat_m_file_encoding: 'UTF-8'
|
tomcat_m_file_encoding: 'UTF-8'
|
||||||
tomcat_m_restart_timeout: 300
|
tomcat_m_restart_timeout: 300
|
||||||
|
|
|
@ -1,28 +1,13 @@
|
||||||
---
|
---
|
||||||
- name: tomcat restart instances with changed configs
|
- name: tomcat multiple-instances restart
|
||||||
service: name='tomcat-instance-{{ item.item.http_port }}' state=restarted sleep=20
|
service:
|
||||||
with_items: '{{ restart_needed.results }}'
|
name: 'tomcat-instance-{{ item.http_port }}'
|
||||||
when: item is changed
|
state: restarted
|
||||||
ignore_errors: True
|
sleep: 20
|
||||||
|
loop: '{{ tomcat_m_instances }}'
|
||||||
- name: tomcat restart instances with changed jmx config
|
ignore_errors: true
|
||||||
service: name='tomcat-instance-{{ item.item.http_port }}' state=restarted sleep=20
|
|
||||||
with_items: '{{ jmx_restart_needed.results }}'
|
|
||||||
when: item is changed
|
|
||||||
ignore_errors: True
|
|
||||||
|
|
||||||
- name: tomcat instances restart
|
|
||||||
service: name='tomcat-instance-{{ item.http_port }}' state=restarted sleep=20
|
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
|
||||||
ignore_errors: True
|
|
||||||
|
|
||||||
- name: enable tomcat instances
|
|
||||||
service: name='tomcat-instance-{{ item.http_port }}' state=started enabled=yes sleep=20
|
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
|
||||||
ignore_errors: True
|
|
||||||
|
|
||||||
- name: disable tomcat instances
|
- name: disable tomcat instances
|
||||||
service: name='tomcat-instance-{{ item.http_port }}' state=stopped enabled=no sleep=20
|
service: name='tomcat-instance-{{ item.http_port }}' state=stopped enabled=no sleep=20
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
loop: '{{ tomcat_m_instances }}'
|
||||||
ignore_errors: True
|
ignore_errors: true
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,7 @@
|
||||||
with_nested:
|
with_nested:
|
||||||
- '{{ tomcat_m_instances }}'
|
- '{{ tomcat_m_instances }}'
|
||||||
- [ 'context.xml' ]
|
- [ 'context.xml' ]
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||||
|
|
||||||
- name: Install catalina.properties
|
- name: Install catalina.properties
|
||||||
|
@ -91,8 +90,7 @@
|
||||||
with_nested:
|
with_nested:
|
||||||
- '{{ tomcat_m_instances }}'
|
- '{{ tomcat_m_instances }}'
|
||||||
- [ 'catalina.properties' ]
|
- [ 'catalina.properties' ]
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_catalina_properties' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_catalina_properties' ]
|
||||||
|
|
||||||
- name: Populate the instances conf/policy.d directory
|
- name: Populate the instances conf/policy.d directory
|
||||||
|
@ -100,8 +98,7 @@
|
||||||
with_nested:
|
with_nested:
|
||||||
- '{{ tomcat_m_instances }}'
|
- '{{ tomcat_m_instances }}'
|
||||||
- [ '01system.policy', '02debian.policy', '03catalina.policy', '04webapps.policy', '50local.policy' ]
|
- [ '01system.policy', '02debian.policy', '03catalina.policy', '04webapps.policy', '50local.policy' ]
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||||
|
|
||||||
- name: Install logging.properties if we do not use log4j for the tomcat logging
|
- name: Install logging.properties if we do not use log4j for the tomcat logging
|
||||||
|
@ -112,22 +109,19 @@
|
||||||
when:
|
when:
|
||||||
- tomcat_use_log4j is defined
|
- tomcat_use_log4j is defined
|
||||||
- not tomcat_use_log4j | bool
|
- not tomcat_use_log4j | bool
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances' ]
|
tags: [ 'tomcat', 'tomcat_instances' ]
|
||||||
|
|
||||||
- name: Install the server.xml conf file
|
- 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
|
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 }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_serverxml' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_serverxml' ]
|
||||||
|
|
||||||
- name: Install the web.xml file
|
- 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
|
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 }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_serverxml' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_serverxml' ]
|
||||||
|
|
||||||
- name: Install the tomcat-admin package if the host-manager or manager apps are required
|
- name: Install the tomcat-admin package if the host-manager or manager apps are required
|
||||||
|
@ -138,24 +132,21 @@
|
||||||
- name: Install the catalina configuration for the 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
|
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 }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
register: restart_needed
|
|
||||||
when: tomcat_m_manager_install | bool
|
when: tomcat_m_manager_install | bool
|
||||||
notify: tomcat restart instances with changed configs
|
notify: tomcat multiple-instances restart
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_manager' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_manager' ]
|
||||||
|
|
||||||
- name: Install the catalina configuration for the tomcat host 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
|
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 }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
register: restart_needed
|
|
||||||
when: tomcat_m_host_manager_install | bool
|
when: tomcat_m_host_manager_install | bool
|
||||||
notify: tomcat restart instances with changed configs
|
notify: tomcat multiple-instances restart
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager' ]
|
||||||
|
|
||||||
- name: Install the catalina configuration for the tomcat 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
|
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 }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager', 'tomcat_manager' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_host_manager', 'tomcat_manager' ]
|
||||||
|
|
||||||
- name: Install the instances startup scripts
|
- name: Install the instances startup scripts
|
||||||
|
@ -167,7 +158,7 @@
|
||||||
- name: Install the tomcat instances default file
|
- name: Install the tomcat instances default file
|
||||||
template: src=tomcat-default.j2 dest=/etc/default/tomcat-instance-{{ item.http_port }} mode=0640 owner=root group={{ item.user }}
|
template: src=tomcat-default.j2 dest=/etc/default/tomcat-instance-{{ item.http_port }} mode=0640 owner=root group={{ item.user }}
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
notify: tomcat instances restart
|
notify: tomcat multiple-instances restart
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_default', 'jdk' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_default', 'jdk' ]
|
||||||
|
|
||||||
- name: Reload the systemd daemon if we are running on a systemd-backed server
|
- name: Reload the systemd daemon if we are running on a systemd-backed server
|
||||||
|
@ -179,8 +170,7 @@
|
||||||
- name: Install a custom context.xml file
|
- 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
|
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 }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
register: restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed configs
|
|
||||||
when: tomcat_m_jndi_pool | bool
|
when: tomcat_m_jndi_pool | bool
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_contextxml', 'jdk' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_contextxml', 'jdk' ]
|
||||||
|
|
||||||
|
@ -197,8 +187,7 @@
|
||||||
- item.jmx_auth_enabled is defined
|
- item.jmx_auth_enabled is defined
|
||||||
- item.jmx_enabled | bool
|
- item.jmx_enabled | bool
|
||||||
- item.jmx_auth_enabled | bool
|
- item.jmx_auth_enabled | bool
|
||||||
register: jmx_restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed jmx config
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_jmx' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_jmx' ]
|
||||||
|
|
||||||
- name: Install the jmx role file
|
- name: Install the jmx role file
|
||||||
|
@ -209,8 +198,7 @@
|
||||||
- item.jmx_auth_enabled is defined
|
- item.jmx_auth_enabled is defined
|
||||||
- item.jmx_enabled | bool
|
- item.jmx_enabled | bool
|
||||||
- item.jmx_auth_enabled | bool
|
- item.jmx_auth_enabled | bool
|
||||||
register: jmx_restart_needed
|
notify: tomcat multiple-instances restart
|
||||||
notify: tomcat restart instances with changed jmx config
|
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_jmx' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_jmx' ]
|
||||||
|
|
||||||
- name: Start all the tomcat instances
|
- name: Start all the tomcat instances
|
||||||
|
|
Loading…
Reference in New Issue