62 lines
1.3 KiB
YAML
62 lines
1.3 KiB
YAML
---
|
|
# Install APT dependencies
|
|
- include_tasks: 0_apt_dependencies.yml
|
|
|
|
# Create CodiMD user and group
|
|
- include_tasks: 1_user_group.yml
|
|
|
|
# Download CodiMD
|
|
- 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
|
|
|
|
# Setup dependencies and configs
|
|
- name: Install CodiMD dependencies
|
|
yarn:
|
|
path: /var/local/codimd/codimd
|
|
production: true
|
|
become: true
|
|
become_user: codimd
|
|
register: yarn_result
|
|
retries: 3
|
|
until: yarn_result is succeeded
|
|
|
|
# Connection to database
|
|
- name: Connect CodiMD to PostgreSQL db
|
|
template:
|
|
src: sequelizerc.j2
|
|
dest: /var/local/codimd/codimd/.sequelizerc
|
|
owner: codimd
|
|
group: codimd
|
|
mode: 0600
|
|
|
|
# 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:
|
|
src: 'systemd/codimd.service.j2'
|
|
dest: '/etc/systemd/system/codimd.service'
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: Reload systemd daemons
|
|
|
|
# Run
|
|
- name: Ensure that CodiMD is started
|
|
service:
|
|
name: codimd
|
|
state: started
|
|
enabled: true
|