mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 08:16:28 +00:00
64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
---
|
|
- hosts: localhost
|
|
vars:
|
|
bench_path: "/home/{{ ansible_user_id }}/frappe-bench"
|
|
|
|
tasks:
|
|
|
|
# In case we are re-running the script, we would like to skip the site creation
|
|
- name: Check whether a site exists
|
|
stat: path="{{ bench_path }}/sites/{{ site }}"
|
|
register: site_folder
|
|
|
|
- name: Create new site
|
|
command: bench new-site {{ site }} --admin-password {{ admin_password }} --mariadb-root-password {{ mysql_root_password }}
|
|
args:
|
|
chdir: "{{ bench_path }}"
|
|
when: not site_folder.stat.exists
|
|
|
|
- name: Check ERPNext App exists
|
|
stat: path="{{ bench_path }}/apps/erpnext"
|
|
register: app
|
|
|
|
# In case we are re-running the script, we would like to skip getting ERPNext App
|
|
- name: Get-app erpnext app
|
|
command: bench get-app erpnext https://github.com/frappe/erpnext.git --branch {{ branch }}
|
|
args:
|
|
chdir: '{{ bench_path }}'
|
|
when: not app.stat.exists
|
|
|
|
- name: Install erpnext app
|
|
command: bench --site {{ site }} install-app erpnext
|
|
args:
|
|
chdir: '{{ bench_path }}'
|
|
|
|
- name: Change permissions for frappe home folder
|
|
become: yes
|
|
become_user: root
|
|
file:
|
|
dest: '{{ ansible_env.HOME }}'
|
|
owner: '{{ ansible_user_id }}'
|
|
group: '{{ ansible_user_id }}'
|
|
mode: 0755
|
|
recurse: yes
|
|
state: directory
|
|
|
|
- name: Setup production
|
|
become: yes
|
|
become_user: root
|
|
command: bench setup production {{ ansible_user_id }}
|
|
args:
|
|
chdir: '{{ bench_path }}'
|
|
|
|
- name: Setup Sudoers
|
|
become: yes
|
|
become_user: root
|
|
command: bench setup sudoers {{ ansible_user_id }}
|
|
args:
|
|
chdir: '{{ bench_path }}'
|
|
|
|
- name: Restart the bench
|
|
command: bench restart
|
|
args:
|
|
chdir: '{{ bench_path }}'
|