Create deploy.yml

This commit is contained in:
cjpcloud 2019-03-11 17:43:55 +05:30 committed by GitHub
parent 91fa97102f
commit aeae224096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

51
deploy.yml Normal file
View file

@ -0,0 +1,51 @@
---
- hosts: QA
tasks:
- name: Install add-apt-repostory
become: yes
apt: name=software-properties-common state=latest
- name: Add Oracle Java Repository
become: yes
apt_repository: repo='ppa:webupd8team/java'
- name: Accept Java 8 License
become: yes
debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'
- name: Install Oracle Java 8
become: yes
apt: name={{item}} state=latest
with_items:
- oracle-java8-installer
- ca-certificates
- oracle-java8-set-default
- name: Create Folder
file:
path: /home/ubuntu/tomcat
state: directory
mode: 0755
owner: ubuntu
group: ubuntu
- name: Download Tomcat
get_url: url=https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.27/bin/apache-tomcat-8.0.27.tar.gz dest=/home/ubuntu/tomcat
- name: Extract archive
unarchive: src=/home/ubuntu/tomcat/apache-tomcat-8.0.27.tar.gz dest=/home/ubuntu/tomcat remote_src=yes
- name: Download Application
get_url: url=https://s3-us-west-1.amazonaws.com/tejanew/petclinic.war dest=/home/ubuntu/
- name: start apache-tomcat-8.0.27
command: /home/ubuntu/tomcat/apache-tomcat-8.0.27/bin/startup.sh
- name: copy petclinic.war
shell: cp /home/ubuntu/petclinic.war /home/ubuntu/tomcat/apache-tomcat-8.0.27/webapps/
- name: stop apache-tomcat-8.0.27
command: nohup "/home/ubuntu/tomcat/apache-tomcat-8.0.27/bin/shutdown.sh"
- name: start apache-tomcat-8.0.27
command: nohup "/home/ubuntu/tomcat/apache-tomcat-8.0.27/bin/startup.sh"