ansible/roles/matrix-appservice-discord/tasks/main.yml
2019-03-24 17:05:24 +01:00

59 lines
1.7 KiB
YAML

---
# Create CodiMD user and group
- include_tasks: 1_user_group.yml
# Download CodiMD
- name: Clone matrix-appservice-discord project
git:
repo: https://github.com/Half-Shot/matrix-appservice-discord.git
dest: /var/local/matrix-appservice-discord/matrix-appservice-discord
version: 14cf2829510e8b7b99b3238e2deaddf296ab4b76
become: true
become_user: matrix-appservice-discord
# Setup dependencies
# May create issues with package-lock.json not in gitignore
- name: Install matrix-appservice-discord dependencies
npm:
path: /var/local/matrix-appservice-discord/matrix-appservice-discord
become: true
become_user: matrix-appservice-discord
register: npm_result
retries: 3
until: npm_result is succeeded
# Typescript into javascript
- name: Compile matrix-appservice-discord
command: ./node_modules/.bin/tsc
args:
chdir: /var/local/matrix-appservice-discord/matrix-appservice-discord
register: npm_build_result
changed_when: npm_build_result
become: true
become_user: matrix-appservice-discord
# Configure
- name: Configure matrix-appservice-discord
template:
src: config.yaml.j2
dest: /var/local/matrix-appservice-discord/matrix-appservice-discord/config.yaml
owner: matrix-appservice-discord
group: matrix-appservice-discord
mode: 0600
# Service file
- name: Install matrix-appservice-discord systemd unit
template:
src: 'systemd/matrix-appservice-discord.service.j2'
dest: '/etc/systemd/system/matrix-appservice-discord.service'
owner: root
group: root
mode: 0644
notify: Reload systemd daemons
# Run
#- name: Ensure that matrix-appservice-discord is started
# service:
# name: matrix-appservice-discord
# state: started
# enabled: true