Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sathishkumarpkd/a8425ac8134074692f08e6064cb392de to your computer and use it in GitHub Desktop.
Save sathishkumarpkd/a8425ac8134074692f08e6064cb392de to your computer and use it in GitHub Desktop.
---
- hosts: webservers
vars:
- http_port: 8080
- tomcat_version: 8.5.53
tasks:
- name: add group "tomcat"
group: name=tomcat
- name: add user "tomcat"
user: name=tomcat group=tomcat createhome=yes
become: true
- name: Download Tomcat
get_url: url=http://apachemirror.wuchna.com/tomcat/tomcat-8/v{{ tomcat_version }}/bin/apache-tomcat-{{ tomcat_version }}.tar.gz dest=/opt/apache-tomcat-{{ tomcat_version }}.tar.gz
- name: Extract Tomcat archive
command: tar zxvf /opt/apache-tomcat-{{ tomcat_version }}.tar.gz -C /opt/ creates=/opt/apache-tomcat-{{ tomcat_version }}
- name: Change ownership of Tomcat installation
file: path=/opt/apache-tomcat-{{ tomcat_version }} owner=tomcat group=tomcat state=directory recurse=yes
- name: Change the working directory to Tomcat Apache before running Tomcat Apache
shell: ./startup.sh
args:
chdir: /opt/apache-tomcat-{{ tomcat_version }}/bin/
become: true
become_user: tomcat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment