Last active
July 22, 2016 10:22
-
-
Save grahamoregan/6b0e799089a993f535c5959f2e73f598 to your computer and use it in GitHub Desktop.
simple ansible deploy script
This file contains 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
- name: Sample deploy | |
hosts: backend | |
sudo: yes | |
remote_user: ubuntu | |
gather_facts: no | |
vars: | |
- build_dir: "/tmp/build" | |
- deploy_dir: "/opt/deploy" | |
tasks: | |
- synchronize: | |
src="./" | |
dest="{{ build_dir }}" | |
recursive=yes | |
delete=yes | |
owner=no | |
group=no | |
tags: | |
- deploy | |
- build | |
- shell: /opt/apache-maven-3.3.3/bin/mvn package -DskipTests chdir="{{ build_dir }}" | |
tags: | |
- build | |
- shell: cp {{ deploy_dir }}/backend.jar {{ deploy_dir }}/backend.jar.$(date +%Y-%m-%d-%H-%m-%S) | |
- shell: cp {{ build_dir}}/target/backend-0.1.jar {{ deploy_dir }}/backend.jar | |
- shell: cp {{ build_dir}}/config.yml {{ deploy_dir }}/config.yml | |
- copy: | |
src="./upstart.conf" | |
dest="/etc/init/backend.conf" | |
- service: | |
name="backend" | |
state="restarted" | |
tags: | |
- deploy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment