Skip to content

Commit

Permalink
Included backup
Browse files Browse the repository at this point in the history
  • Loading branch information
imranteli authored Sep 1, 2018
1 parent 895a435 commit 31a8f3a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ansible/ubuntuVroDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
path: /var/lib/tomcat8/webapps/ROOT
register: artifact

- name: Create directory for backup
file:
path: /opt/vprofile_backup
state: directory

- name: Take backup of war file
shell: "cp -rf /var/lib/tomcat8/webapps/ROOT/ /opt/vprofile_backup"
shell: "cp -rf /var/lib/tomcat8/webapps/ROOT /opt/vprofile_backup/"
when: artifact.stat.isdir is defined and artifact.stat.isdir

- name: Clean old artifact
Expand All @@ -48,7 +53,7 @@
path: /var/lib/tomcat8/webapps/ROOT/WEB-INF

- name: Restore config file
shell: "cp -f /opt/vprofile_backup/WEB-INF/classes/application.properties /var/lib/tomcat8/webapps/ROOT/WEB-INF/classes/application.properties"
shell: "cp -f /opt/vprofile_backup/ROOT/WEB-INF/classes/application.properties /var/lib/tomcat8/webapps/ROOT/WEB-INF/classes/application.properties"

- name: Restart tomcat again
service:
Expand Down

0 comments on commit 31a8f3a

Please sign in to comment.