-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yml
48 lines (47 loc) · 1.42 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
43
44
45
46
47
48
---
- name: Deploy PGXN Site
hosts: main
tags: [deploy]
tasks:
- name: Include Variables
include_vars: file=vars.yml name=app
- name: Install Control Script
template:
src: "site_ctl.j2"
dest: "{{ app.release_dir }}/{{ app.name }}-{{ app.version }}/bin/site_ctl"
owner: pgxn
group: pgxn
mode: "u=rwx,g=rx,o="
- name: Deploy {{ app.name }}-{{ app.version }}
file:
state: link
src: "{{ item.src }}"
dest: "{{ item.dst }}"
force: yes
loop:
- src: "{{ app.release_dir }}/{{ app.name }}-{{ app.version }}"
dst: "{{ app.release_dir }}/{{ app.name }}"
- src: "{{ app.release_dir }}/{{ app.name }}-{{ app.version }}"
dst: "{{ app.deploy_dir }}"
- name: Restart PGXN
hosts: site
tags: [deploy]
tasks:
- name: Include Variables
include_vars: file=vars.yml name=app
- name: Setup Site Cron Environment
cronvar: name=MAILTO value={{ app.opt.errors_to }}
- name: Link from {{ app.home_dir }}
file:
state: link
src: "{{ app.deploy_dir }}"
dest: "{{ app.home_dir }}/{{ app.name }}"
force: yes
- name: Deploy Site Cron Job
cron:
name: Run PGXN Site
special_time: reboot
job: "{{ app.deploy_dir }}/bin/site_ctl start"
- name: Restart PGXN Site
command:
cmd: "{{ app.deploy_dir }}/bin/site_ctl restart"