Last active
April 19, 2025 05:56
-
-
Save anujdevopslearn/efa28700a3b8aca18d2866aa2d24fa02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: webservers | |
vars: | |
- http_port: 8080 | |
- tomcat_version: 8.5.83 | |
tasks: | |
- name: JDK Installation | |
apt: | |
name: default-jdk | |
update_cache: yes | |
- name: add group "tomcat" | |
group: name=tomcat | |
- name: add user "tomcat" | |
user: name=tomcat group=tomcat createhome=yes | |
- name: Download Tomcat | |
get_url: url=https://archive.apache.org/dist/tomcat/tomcat-8/v{{ tomcat_version }}/bin/apache-tomcat-{{ tomcat_version }}.tar.gz dest=/opt/apache-tomcat-{{ tomcat_version }}.tar.gz | |
- name: Create Tomcat Directory | |
file: path=/opt/tomcat state=directory | |
- name: Extract Tomcat archive | |
command: tar zxvf /opt/apache-tomcat-{{ tomcat_version }}.tar.gz -C /opt | |
- name: Moving Tomcat Content | |
command: mv /opt/apache-tomcat-{{ tomcat_version }}/* /opt/tomcat | |
- name: Change ownership of Tomcat installation | |
file: path=/opt/tomcat owner=tomcat group=tomcat state=directory recurse=yes | |
- name: Change the working directory to Tomcat Apache before running Tomcat Apache | |
shell: nohup /opt/tomcat/bin/startup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment