2019-02-07 13:37:11 +01:00
|
|
|
---
|
|
|
|
# Install APT dependencies
|
|
|
|
- include_tasks: 0_apt_dependencies.yml
|
|
|
|
|
|
|
|
# Create CodiMD user and group
|
|
|
|
- include_tasks: 1_user_group.yml
|
|
|
|
|
|
|
|
# Download CodiMD
|
2019-03-04 15:08:05 +01:00
|
|
|
- name: Clone CodiMD project
|
|
|
|
git:
|
|
|
|
repo: https://github.com/hackmdio/codimd.git
|
|
|
|
dest: /var/local/codimd/codimd
|
|
|
|
version: 1.3.0
|
|
|
|
become: true
|
|
|
|
become_user: codimd
|
|
|
|
notify: Build front-end for CodiMD
|
2019-02-07 13:37:11 +01:00
|
|
|
|
|
|
|
# Setup dependencies and configs
|
2019-03-11 17:44:42 +01:00
|
|
|
- name: Install CodiMD dependencies
|
2019-03-11 17:49:48 +01:00
|
|
|
yarn:
|
|
|
|
path: /var/local/codimd/codimd
|
|
|
|
production: true
|
2019-03-03 09:16:52 +01:00
|
|
|
become: true
|
2019-02-07 13:37:11 +01:00
|
|
|
become_user: codimd
|
2019-03-11 18:12:55 +01:00
|
|
|
register: yarn_result
|
|
|
|
retries: 3
|
|
|
|
until: yarn_result is succeeded
|
2019-02-07 13:37:11 +01:00
|
|
|
|
|
|
|
# Connection to database
|
2019-02-09 08:07:10 +01:00
|
|
|
- name: Connect CodiMD to PostgreSQL db
|
2019-02-07 13:37:11 +01:00
|
|
|
template:
|
2019-02-09 10:02:53 +01:00
|
|
|
src: sequelizerc.j2
|
2019-02-07 13:37:11 +01:00
|
|
|
dest: /var/local/codimd/codimd/.sequelizerc
|
|
|
|
owner: codimd
|
|
|
|
group: codimd
|
|
|
|
mode: 0600
|
|
|
|
|
2019-02-09 10:02:53 +01:00
|
|
|
# Configure
|
|
|
|
- name: Configure CodiMD
|
|
|
|
template:
|
|
|
|
src: config.json.j2
|
|
|
|
dest: /var/local/codimd/codimd/config.json
|
|
|
|
owner: codimd
|
|
|
|
group: codimd
|
|
|
|
mode: 0600
|
|
|
|
|
|
|
|
# Service file
|
|
|
|
- name: Install CodiMD systemd unit
|
|
|
|
template:
|
2019-03-23 19:13:02 +01:00
|
|
|
src: systemd/codimd.service.j2
|
|
|
|
dest: /etc/systemd/system/codimd.service
|
2019-02-09 10:02:53 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: Reload systemd daemons
|
2019-02-09 09:29:14 +01:00
|
|
|
|
2019-02-09 10:02:53 +01:00
|
|
|
# Run
|
|
|
|
- name: Ensure that CodiMD is started
|
|
|
|
service:
|
|
|
|
name: codimd
|
|
|
|
state: started
|
|
|
|
enabled: true
|