58 lines
1.4 KiB
YAML
58 lines
1.4 KiB
YAML
---
|
|
# Create service user
|
|
- include_tasks: service_user.yml
|
|
|
|
- name: "Clone {{ appservice_name }} project"
|
|
git:
|
|
repo: "{{ appservice_repo }}"
|
|
dest: "{{ appservice_path }}"
|
|
version: master
|
|
become: true
|
|
become_user: "{{ appservice_user }}"
|
|
|
|
# Setup dependencies
|
|
- name: "Install {{ appservice_name }} dependencies"
|
|
npm:
|
|
path: "{{ appservice_path }}"
|
|
production: true
|
|
become: true
|
|
become_user: "{{ appservice_user }}"
|
|
register: npm_result
|
|
retries: 3
|
|
until: npm_result is succeeded
|
|
|
|
- name: "Configure {{ appservice_name }}"
|
|
template:
|
|
src: config.yaml.j2
|
|
dest: "{{ appservice_path }}/config/config.yaml"
|
|
owner: "{{ appservice_user }}"
|
|
group: nogroup
|
|
mode: 0600
|
|
|
|
# Service file
|
|
- name: "Install {{ appservice_name }} systemd unit"
|
|
template:
|
|
src: systemd/matrix-appservice-webhooks.service.j2
|
|
dest: "/etc/systemd/system/{{ appservice_name }}.service"
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: Reload systemd daemons
|
|
|
|
# TODO generate registration
|
|
|
|
- name: Copy appservice registration file
|
|
copy:
|
|
src: "{{ appservice_path }}/appservice-registration-webhooks.yaml"
|
|
dest: "/etc/matrix-synapse/{{ appservice_name }}-registration.yaml"
|
|
owner: matrix-synapse
|
|
group: nogroup
|
|
mode: 0600
|
|
remote_src: yes
|
|
|
|
# Run
|
|
- name: "Ensure that {{ appservice_name }} is started"
|
|
service:
|
|
name: "{{ appservice_name }}"
|
|
state: started
|
|
enabled: true
|