|
1 | 1 | --- |
2 | | -- name: ensure tomcat is installed |
3 | | - include: install.yml |
| 2 | +- name: include variables relevant to install type ( binary ) |
| 3 | + include_vars: binary_install.yml |
| 4 | + when: not tomcat_install_from_repo |
4 | 5 | tags: ['tomcat'] |
5 | 6 |
|
| 7 | +- name: include variables relevant to install type ( rpm ) |
| 8 | + include_vars: package_install.yml |
| 9 | + when: tomcat_install_from_repo |
| 10 | + tags: ['tomcat'] |
| 11 | + |
| 12 | +- name: ensure tomcat is installed (binary) |
| 13 | + include_tasks: install.yml |
| 14 | + when: not tomcat_install_from_repo |
| 15 | + tags: ['tomcat'] |
| 16 | + |
| 17 | +- name: ensure tomcat is installed (rpm) |
| 18 | + include_tasks: install_repo.yml |
| 19 | + when: tomcat_install_from_repo |
| 20 | + |
6 | 21 | - set_fact: |
7 | 22 | tomcat_shutdown_value: "{{ lookup('password', '/dev/null length=20 chars=ascii_letters') }}" |
8 | 23 | when: tomcat_shutdown_value == "SETME" |
9 | 24 | tags: ['tomcat'] |
10 | 25 |
|
| 26 | +- name: give tomcat group access to read all in CATALINA_HOME |
| 27 | + command: "find {{ tomcat_catalina_home }}/ -exec /bin/chgrp {{ tomcat_group }} {} \\;" |
| 28 | + tags: ['tomcat'] |
| 29 | + |
| 30 | +- name: restrict access to CATALINA_HOME |
| 31 | + file: path="{{ tomcat_catalina_home }}" state=directory owner="root" group="{{ tomcat_group }}" mode='0750' |
| 32 | + tags: ['tomcat'] |
| 33 | + |
| 34 | +- name: ensure logs directory exists in CATALINA_HOME |
| 35 | + file: path="{{ tomcat_catalina_home }}/logs" state=directory owner="{{ tomcat_user }}" group="{{ tomcat_group }}" mode='0750' |
| 36 | + tags: ['tomcat'] |
| 37 | + |
11 | 38 | - name: create CATALINA_BASE dirs |
12 | 39 | file: path="{{ item }}" state=directory owner="{{ tomcat_user }}" group="{{ tomcat_group }}" mode='0751' |
13 | 40 | with_items: |
|
87 | 114 | when: tomcat_enable_manager |
88 | 115 | tags: ['tomcat'] |
89 | 116 |
|
90 | | -- name: ensure tomcat setenv.sh exists |
91 | | - template: |
92 | | - src: catalina_base.bin.setenv.sh.j2 |
93 | | - dest: "{{ tomcat_catalina_base }}/bin/setenv.sh" |
94 | | - owner: "{{ tomcat_user }}" |
95 | | - group: "{{ tomcat_group }}" |
96 | | - mode: 0600 |
97 | | - tags: ['tomcat'] |
98 | | - |
99 | 117 | - name: ensure tomcat-users.xml exists |
100 | 118 | template: |
101 | 119 | src: catalina_base.conf.tomcat-users.xml.j2 |
|
174 | 192 | template: src=etc.logrotate.tomcat.j2 dest=/etc/logrotate.d/tomcat owner=root group=root mode=0644 |
175 | 193 | tags: ['tomcat', 'logrotate'] |
176 | 194 |
|
| 195 | +# binary only tasks |
| 196 | +- name: ensure tomcat setenv.sh exists |
| 197 | + template: |
| 198 | + src: catalina_base.bin.setenv.sh.j2 |
| 199 | + dest: "{{ tomcat_catalina_base }}/bin/setenv.sh" |
| 200 | + owner: "{{ tomcat_user }}" |
| 201 | + group: "{{ tomcat_group }}" |
| 202 | + mode: 0600 |
| 203 | + when: not tomcat_install_from_repo |
| 204 | + tags: ['tomcat'] |
| 205 | + |
| 206 | +# rpm only tasks |
| 207 | + |
| 208 | +- name: ensure tomcat env var file exists |
| 209 | + template: |
| 210 | + src: etc.sysconfig.tomcat.j2 |
| 211 | + dest: "/etc/sysconfig/{{ tomcat_service }}" |
| 212 | + owner: "{{ tomcat_user }}" |
| 213 | + group: "{{ tomcat_group }}" |
| 214 | + mode: 0600 |
| 215 | + when: tomcat_install_from_repo |
| 216 | + tags: ['tomcat'] |
| 217 | + |
177 | 218 | - name: ensure tomcat is started |
178 | | - service: name=tomcat state=started |
| 219 | + service: |
| 220 | + name: "{{ tomcat_service }}" |
| 221 | + enabled: true |
| 222 | + state: started |
179 | 223 | when: tomcat_start_service |
180 | 224 | tags: ['tomcat'] |
0 commit comments