ansible/roles/codimd/tasks/main.yml
2019-04-06 15:19:52 +02:00

60 lines
1.3 KiB
YAML

---
# Install APT dependencies
- include_tasks: 0_apt_dependencies.yml
# Create service user
- include_tasks: service_user.yml
- name: "Clone {{ service_name }} project"
git:
repo: "{{ service_repo }}"
dest: "{{ service_path }}"
version: 1.3.0
become: true
become_user: "{{ service_user }}"
notify: Build front-end for CodiMD
# Setup dependencies
- name: "Install {{ service_name }} dependencies"
yarn:
path: "{{ service_path }}"
production: true
become: true
become_user: "{{ service_user }}"
register: yarn_result
retries: 3
until: yarn_result is succeeded
# Connection to database
- name: Connect CodiMD to PostgreSQL db
template:
src: sequelizerc.j2
dest: "{{ service_path }}/.sequelizerc"
owner: "{{ service_user }}"
group: nogroup
mode: 0600
- name: "Configure {{ service_name }}"
template:
src: config.json.j2
dest: "{{ service_path }}/config.json"
owner: "{{ service_user }}"
group: nogroup
mode: 0600
# Service file
- name: "Install {{ service_name }} systemd unit"
template:
src: systemd/codimd.service.j2
dest: "/etc/systemd/system/{{ service_name }}.service"
owner: root
group: root
mode: 0644
# Run
- name: "Ensure that {{ service_name }} is started"
systemd:
name: "{{ service_name }}"
state: started
enabled: true
daemon_reload: true