2019-03-10 11:50:07 +01:00
|
|
|
---
|
2019-03-29 19:25:11 +01:00
|
|
|
# Create service user
|
|
|
|
- include_tasks: service_user.yml
|
2019-03-10 11:50:07 +01:00
|
|
|
|
2019-03-29 19:25:11 +01:00
|
|
|
- name: "Clone {{ appservice_name }} project"
|
2019-03-10 11:50:07 +01:00
|
|
|
git:
|
2019-03-29 19:25:11 +01:00
|
|
|
repo: "{{ appservice_repo }}"
|
|
|
|
dest: "{{ appservice_path }}"
|
2019-03-10 11:50:07 +01:00
|
|
|
version: 0.11.2
|
|
|
|
become: true
|
2019-03-29 19:25:11 +01:00
|
|
|
become_user: "{{ appservice_user }}"
|
2019-03-10 11:50:07 +01:00
|
|
|
|
|
|
|
# Setup dependencies
|
2019-03-29 19:25:11 +01:00
|
|
|
- name: "Install {{ appservice_name }} dependencies"
|
2019-03-11 17:44:42 +01:00
|
|
|
npm:
|
2019-03-29 19:25:11 +01:00
|
|
|
path: "{{ appservice_path }}"
|
2019-03-11 17:44:42 +01:00
|
|
|
production: true
|
2019-03-10 11:50:07 +01:00
|
|
|
become: true
|
2019-03-29 19:25:11 +01:00
|
|
|
become_user: "{{ appservice_user }}"
|
2019-03-11 18:12:55 +01:00
|
|
|
register: npm_result
|
|
|
|
retries: 3
|
|
|
|
until: npm_result is succeeded
|
2019-03-10 11:50:07 +01:00
|
|
|
|
2019-03-29 19:25:11 +01:00
|
|
|
- name: "Configure {{ appservice_name }}"
|
2019-03-10 11:50:07 +01:00
|
|
|
template:
|
|
|
|
src: config.yaml.j2
|
2019-03-29 19:25:11 +01:00
|
|
|
dest: "{{ appservice_path }}/config.yaml"
|
|
|
|
owner: "{{ appservice_user }}"
|
|
|
|
group: nogroup
|
2019-03-10 11:50:07 +01:00
|
|
|
mode: 0600
|
|
|
|
|
|
|
|
# Service file
|
2019-03-29 19:25:11 +01:00
|
|
|
- name: "Install {{ appservice_name }} systemd unit"
|
2019-03-10 11:50:07 +01:00
|
|
|
template:
|
2019-03-23 19:13:02 +01:00
|
|
|
src: systemd/matrix-appservice-irc.service.j2
|
2019-03-29 19:25:11 +01:00
|
|
|
dest: "/etc/systemd/system/{{ appservice_name }}.service"
|
2019-03-10 11:50:07 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: Reload systemd daemons
|
|
|
|
|
2019-03-29 19:25:11 +01:00
|
|
|
# TODO generate registration
|
|
|
|
|
|
|
|
#- name: Copy appservice registration file
|
|
|
|
# copy:
|
|
|
|
# src: "{{ appservice_path }}/discord-registration.yaml"
|
|
|
|
# dest: "/etc/matrix-synapse/{{ appservice_name }}-registration.yaml"
|
|
|
|
# owner: matrix-synapse
|
|
|
|
# group: nogroup
|
|
|
|
# mode: 0600
|
|
|
|
# remote_src: yes
|
|
|
|
|
2019-03-10 11:50:07 +01:00
|
|
|
# Run
|
|
|
|
#- name: Ensure that matrix-appservice-irc is started
|
|
|
|
# service:
|
|
|
|
# name: matrix-appservice-irc
|
|
|
|
# state: started
|
|
|
|
# enabled: true
|