forked from frappe/bench
/
main.yml
82 lines (68 loc) · 2.22 KB
/
main.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
---
- name: Check if /tmp/.bench exists
stat:
path: /tmp/.bench
register: tmp_bench
- name: Check if bench_repo_path exists
stat:
path: '{{ bench_repo_path }}'
register: bench_repo_register
- name: move /tmp/.bench if it exists
command: 'cp -R /tmp/.bench {{ bench_repo_path }}'
when: tmp_bench.stat.exists and not bench_repo_register.stat.exists
- name: install bench
pip:
name: '{{ bench_repo_path }}'
extra_args: '-e'
become: yes
become_user: root
- name: Overwrite bench if required
file:
state: absent
path: "{{ bench_path }}"
when: overwrite
- name: Check whether bench exists
stat:
path: "{{ bench_path }}"
register: bench_stat
- name: Fix permissions
become_user: root
command: chown {{ frappe_user }} -R {{ user_directory }}
- name: python3 bench init for develop
command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} --python {{ python }}
args:
creates: "{{ bench_path }}"
when: not bench_stat.stat.exists and not production
- name: python3 bench init for production
command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} --python {{ python }}
args:
creates: "{{ bench_path }}"
when: not bench_stat.stat.exists and production
# setup common_site_config
- name: setup config
command: bench setup config
args:
creates: "{{ bench_path }}/sites/common_site_config.json"
chdir: "{{ bench_path }}"
- include_tasks: setup_inputrc.yml
# Setup Procfile
- name: Setup Procfile
command: bench setup procfile
args:
creates: "{{ bench_path }}/Procfile"
chdir: "{{ bench_path }}"
# Setup Redis env for RQ
- name: Setup Redis
command: bench setup redis
args:
creates: "{{ bench_path }}/config/redis_socketio.conf"
chdir: "{{ bench_path }}"
# Setup an ERPNext site
- include_tasks: setup_erpnext.yml
when: not run_travis
# Setup Bench for production environment
- include_tasks: setup_bench_production.yml
vars:
bench_path: "{{ user_directory }}/{{ bench_name }}"
when: not run_travis and production
...