-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathproject.yml
98 lines (66 loc) · 2.6 KB
/
project.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
- name: "clone project"
git:
repo: "{{ repo_url }}"
version: "{{ git_ref }}"
dest: "{{ project_path }}"
accept_hostkey: True
force: True
remote_user: "{{ deployer }}"
- name: "install tool versions"
command: bash -lc 'asdf install' chdir="{{ project_path }}"
async: 1800
remote_user: "{{ deployer }}"
- name: "generate secret key base"
command: "openssl rand -base64 {{ secret_key_base_length }}"
register: openssl_random_string
- name: set secret_key_base
set_fact: secret_key_base="{{ openssl_random_string.stdout }}"
- name: detect endpoint module
command: grep -m 1 -o '[[:alnum:]]*.Endpoint' {{ project_path }}/config/dev.exs
register: grep_endpoint_module
- name: set app_endpoint_module fact
set_fact: app_endpoint_module="{{ grep_endpoint_module.stdout }}"
- name: detect repo module
command: grep -m 1 -o '[[:alnum:]]*.Repo' {{ project_path }}/config/dev.exs
register: grep_repo_module
- name: set app_repo_module fact
set_fact: app_repo_module="{{ grep_repo_module.stdout }}"
- name: check if custom template for prod.secret.exs exists
local_action: stat path="templates/prod.secret.exs.j2"
register: custom_prod_secret_template
- when: custom_prod_secret_template.stat.exists == False
name: add prod.secret.exs from default template
template:
src: default-prod.secret.exs.j2
dest: "{{ project_path }}/config/prod.secret.exs"
remote_user: "{{ deployer }}"
- when: custom_prod_secret_template.stat.exists == True
name: add prod.secret.exs from custom template provided
template:
src: templates/prod.secret.exs.j2
dest: "{{ project_path }}/config/prod.secret.exs"
remote_user: "{{ deployer }}"
- name: check if conform config exists
local_action: stat path="templates/{{ app_name }}.conf.j2"
register: conform_config_template
- when: conform_config_template.stat.exists == True
name: add conform config from custom template provided
template:
src: "templates/{{ app_name }}.conf.j2"
dest: "{{ project_path }}/config/{{ app_name }}.conf"
remote_user: "{{ deployer }}"
- name: install hex
command: bash -lc "mix local.hex --force" chdir="{{ project_path }}"
remote_user: "{{ deployer }}"
- name: install rebar
command: bash -lc "mix local.rebar --force" chdir="{{ project_path }}"
remote_user: "{{ deployer }}"
- name: "fetch mix dependencies"
command: bash -lc 'mix deps.get' chdir="{{ project_path }}"
async: 900
remote_user: "{{ deployer }}"
environment:
MIX_ENV: "{{ mix_env }}"
- name: "create directory for running app"
file: path="{{ deploy_to_path }}" state="directory" owner={{ deployer }}