forked from jason-vallet/graph-ryder-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.yml
42 lines (32 loc) · 1.15 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ansible-playbook -l live -i hosts deploy.yml
# install nginx
# create/check release folder
# copy public to remote folder
# update nginx config
# restart nginx
- hosts: all
vars:
base_path: "~"
release_path: "releases"
api_url: "http://localhost:5000/"
tasks:
- name: Get time
shell: "date +%s"
register: timestamp
- name: Releases dir exists
file: state=directory path={{ base_path }}/{{ release_path }}
- name: Release path exists
file: state=directory path={{ base_path }}/{{ release_path }}/{{ timestamp.stdout }}/
- name: Copy local to remote
synchronize:
src: dist/
dest: "{{ base_path }}/{{ release_path }}/{{ timestamp.stdout }}"
- name: Copy configuration to remote
template:
src: config.j2
dest: "{{ base_path }}/{{ release_path }}/{{ timestamp.stdout }}/config.js"
# Link the current directory and restart
- name: Create the new current link
shell: ln -s {{ base_path }}/{{ release_path }}/{{ timestamp.stdout }} {{ base_path }}/{{ release_path }}/current
- name: Make the new current dir active
shell: mv {{ base_path }}/{{ release_path }}/current {{ base_path }}