matrix-synapse/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 14 Jun 2020 11:40:43 -0500
changeset 43 b86f3fc9fb6f
parent 39 90b1b7c4be70
permissions -rw-r--r--
Added ngircd.

---

- name: add debian backports keys
  become: yes
  apt_key:
    keyserver: "keyserver.ubuntu.com"
    id: "{{item}}"
  loop:
    - "04EE7237B7D453EC"
    - "648ACFD622F3D138"

- name: add matrix repo
  become: yes
  apt_repository: repo="deb http://deb.debian.org/debian buster-backports main"

- name: install matrix synapse
  become: yes
  apt:
    name: "matrix-synapse"
    state: "latest"
    default_release: "buster-backports"
  notify: restart matrix synapse service

- name: create log file
  become: yes
  file:
    path: "/var/log/matrix-synapse/homeserver.log"
    owner: "matrix-synapse"
    group: "root"
    state: "touch"
    mode: "0644"
  changed_when: false

- name: create media data dir
  become: yes
  file:
    path: "{{matrix_synapse_media_store}}"
    owner: "matrix-synapse"
    group: "root"
    state: "directory"
    recurse: yes
    mode: "0750"

- name: configure matrix synapse
  become: yes
  template:
    src: "{{item.src}}"
    dest: "{{item.dest}}"
  notify: restart matrix synapse service
  loop:
    - { src: "homeserver.yaml.j2", dest: "/etc/matrix-synapse/homeserver.yaml" }
    - { src: "log.yaml.j2", dest: "/etc/matrix-synapse/log.yaml" }
    - { src: "server_name.yaml.j2", dest: "/etc/matrix-synapse/conf.d/server_name.yaml" }

- name: install db schema file
  become: yes
  template:
    src: "setup_db.psql.j2"
    dest: "/tmp/setup_db_{{matrix_synapse_pgsql_db}}.psql"
    owner: "postgres"
    group: "postgres"
    mode: "0600"
  changed_when: false

- name: install psql
  become: yes
  become_user: "postgres"
  command: "psql -f /tmp/setup_db_{{matrix_synapse_pgsql_db}}.psql"
  changed_when: false

- name: ensure matrix synapse is started
  become: yes
  systemd: name="matrix-synapse.service" enabled="yes" state="started"