ansible/roles/matrix-appservice-webhooks/tasks/main.yml

59 lines
1.4 KiB
YAML
Raw Normal View History

---
2019-03-29 19:25:11 +01:00
# Create service user
- include_tasks: service_user.yml
2019-03-29 19:25:11 +01:00
- name: "Clone {{ appservice_name }} project"
git:
2019-03-29 19:25:11 +01:00
repo: "{{ appservice_repo }}"
dest: "{{ appservice_path }}"
version: master
become: true
2019-03-29 19:25:11 +01:00
become_user: "{{ appservice_user }}"
# Setup dependencies
2019-03-29 19:25:11 +01:00
- name: "Install {{ appservice_name }} dependencies"
npm:
2019-03-29 19:25:11 +01:00
path: "{{ appservice_path }}"
production: true
become: true
2019-03-29 19:25:11 +01:00
become_user: "{{ appservice_user }}"
register: npm_result
retries: 3
until: npm_result is succeeded
2019-03-29 19:25:11 +01:00
- name: "Configure {{ appservice_name }}"
template:
src: config.yaml.j2
2019-03-29 19:25:11 +01:00
dest: "{{ appservice_path }}/config/config.yaml"
owner: "{{ appservice_user }}"
group: nogroup
mode: 0600
# Service file
2019-03-29 19:25:11 +01:00
- name: "Install {{ appservice_name }} systemd unit"
template:
src: systemd/matrix-appservice-webhooks.service.j2
2019-03-29 19:25:11 +01:00
dest: "/etc/systemd/system/{{ appservice_name }}.service"
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 }}/appservice-registration-webhooks.yaml"
dest: "/etc/matrix-synapse/{{ appservice_name }}-registration.yaml"
owner: matrix-synapse
group: nogroup
mode: 0600
remote_src: yes
# Run
2019-03-29 19:25:11 +01:00
- name: "Ensure that {{ appservice_name }} is started"
service:
name: "{{ appservice_name }}"
state: started
enabled: true