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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
37
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
     3
- name: add debian backports keys
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
     4
  become: yes
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
     5
  apt_key:
39
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
     6
    keyserver: "keyserver.ubuntu.com"
37
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
     7
    id: "{{item}}"
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
     8
  loop:
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
     9
    - "04EE7237B7D453EC"
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    10
    - "648ACFD622F3D138"
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    11
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    12
- name: add matrix repo
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    13
  become: yes
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    14
  apt_repository: repo="deb http://deb.debian.org/debian buster-backports main"
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    15
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
- name: install matrix synapse
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  become: yes
37
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    18
  apt:
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    19
    name: "matrix-synapse"
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    20
    state: "latest"
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    21
    default_release: "buster-backports"
2ef98b7b40d4 Updated to buster-backports matrix.
Luke Hoersten <luke@hoersten.org>
parents: 36
diff changeset
    22
  notify: restart matrix synapse service
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
43
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    24
- name: create log file
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    25
  become: yes
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    26
  file:
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    27
    path: "/var/log/matrix-synapse/homeserver.log"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    28
    owner: "matrix-synapse"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    29
    group: "root"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    30
    state: "touch"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    31
    mode: "0644"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    32
  changed_when: false
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    33
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    34
- name: create media data dir
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    35
  become: yes
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    36
  file:
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    37
    path: "{{matrix_synapse_media_store}}"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    38
    owner: "matrix-synapse"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    39
    group: "root"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    40
    state: "directory"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    41
    recurse: yes
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    42
    mode: "0750"
b86f3fc9fb6f Added ngircd.
Luke Hoersten <luke@hoersten.org>
parents: 39
diff changeset
    43
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
- name: configure matrix synapse
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
  become: yes
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
  template:
39
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    47
    src: "{{item.src}}"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    48
    dest: "{{item.dest}}"
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
  notify: restart matrix synapse service
39
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    50
  loop:
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    51
    - { src: "homeserver.yaml.j2", dest: "/etc/matrix-synapse/homeserver.yaml" }
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    52
    - { src: "log.yaml.j2", dest: "/etc/matrix-synapse/log.yaml" }
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    53
    - { src: "server_name.yaml.j2", dest: "/etc/matrix-synapse/conf.d/server_name.yaml" }
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
39
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    55
- name: install db schema file
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
  become: yes
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
  template:
39
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    58
    src: "setup_db.psql.j2"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    59
    dest: "/tmp/setup_db_{{matrix_synapse_pgsql_db}}.psql"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    60
    owner: "postgres"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    61
    group: "postgres"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    62
    mode: "0600"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    63
  changed_when: false
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    64
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    65
- name: install psql
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    66
  become: yes
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    67
  become_user: "postgres"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    68
  command: "psql -f /tmp/setup_db_{{matrix_synapse_pgsql_db}}.psql"
90b1b7c4be70 Added pgsql support for matrix.
Luke Hoersten <luke@hoersten.org>
parents: 37
diff changeset
    69
  changed_when: false
36
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    70
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    71
- name: ensure matrix synapse is started
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    72
  become: yes
a8627367c7be Add matrix synapse server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    73
  systemd: name="matrix-synapse.service" enabled="yes" state="started"