|
1 |
| -- name: Download Tomcat |
2 |
| - # get_url: url=http://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.53/bin/apache-tomcat-8.5.53.tar.gz dest=/opt/apache-tomcat-8.5.53.tar.gz |
| 1 | +- name: copy Tomcat tar file |
| 2 | + # get_url: url http://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.53/bin/apache-tomcat-8.5.53.tar.gzdest=/opt/apache-tomcat-8.5.53.tar.gz |
3 | 3 | copy:
|
4 | 4 | src: apache-tomcat-8.5.53.tar.gz
|
5 | 5 | dest: /tmp
|
|
8 | 8 | shell: /bin/tar xvf /tmp/apache-tomcat-8.5.53.tar.gz -C /opt
|
9 | 9 |
|
10 | 10 | - name: create Symlink
|
11 |
| - file: |
12 |
| - src: /opt/apache-tomcat-8.5.53 |
13 |
| - path: /opt/tomcat |
| 11 | + file: |
| 12 | + src: /opt/apache-tomcat-8.5.53 |
| 13 | + path: /opt/tomcat |
14 | 14 | owner: tomcat
|
15 | 15 | group: tomcat
|
16 | 16 | state: link
|
17 | 17 |
|
18 | 18 | - name: Change ownership of Tomcat installation
|
19 |
| - file: |
20 |
| - path: /opt/tomcat/ |
21 |
| - owner: tomcat |
22 |
| - group: tomcat |
23 |
| - mode: 0755 |
24 |
| - state: directory |
25 |
| - recurse: yes |
26 |
| - |
27 |
| -- name: Install Tomcat init script |
28 |
| - copy: |
29 |
| - src: tomcat-initscript.sh |
30 |
| - dest: /etc/init.d/tomcatd |
| 19 | + file: |
| 20 | + path: /opt/tomcat/ |
| 21 | + owner: tomcat |
| 22 | + group: tomcat |
31 | 23 | mode: 0755
|
| 24 | + state: directory |
| 25 | + recurse: yes |
32 | 26 |
|
33 |
| -- name: enable service |
34 |
| - shell: update-rc.d tomcatd defaults 95 |
35 |
| - |
36 |
| -- name: Configure Tomcat users |
37 |
| - template: |
38 |
| - src: tomcat-users.xml |
39 |
| - dest: /opt/tomcat/conf/ |
40 |
| - notify: restart tomcat |
| 27 | +- name: create tomcat.service file |
| 28 | + file: |
| 29 | + path: /etc/systemd/system/tomcat.service |
| 30 | + state: touch |
41 | 31 |
|
| 32 | +- name: create tomcat service |
| 33 | + blockinfile: |
| 34 | + path: /etc/systemd/system/tomcat.service |
| 35 | + block: | |
| 36 | + [Unit] |
| 37 | + Description=Tomcat - instance %i |
| 38 | + After=syslog.target network.target |
| 39 | + [Service] |
| 40 | + Type=forking |
| 41 | + User=tomcat |
| 42 | + Group=tomcat |
| 43 | + Environment="CATALINA_HOME=/opt/tomcat/" |
| 44 | + ExecStart=/opt/tomcat/bin/startup.sh |
| 45 | + ExecStop=/opt/tomcat/bin/shutdown.sh |
| 46 | + [Install] |
| 47 | + WantedBy=multi-user.target |
| 48 | +- name: enable & start tomcat service |
| 49 | + systemd: |
| 50 | + name: tomcat |
| 51 | + state: started |
| 52 | + enabled: yes |
42 | 53 | - name: setup app directory
|
43 |
| - file: |
| 54 | + file: |
44 | 55 | path: /app
|
45 | 56 | state: directory
|
0 commit comments