summaryrefslogtreecommitdiff
path: root/matrix/synapse01.yml
blob: d7f38abeee5897d1ff256b396227da5c40709328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- hosts: localhost
  remote_user: peter
  become: yes
  vars:
    federation_server: "matrix.example.com"
    client_server: "example.com"
    dbuser: "synapse"
    dbpass: ""
    database: "synapse"
    packages: [matrix-synapse, postgresql, nginx, python-psycopg2]
    synapse_repo: "files/synapse.list"
    synapse_config: "files/homeserver.yaml.j2"
    nginx_config: "files/nginx.j2"
    ssl_available: false
  tasks:
    - name: Get hostname
      shell: hostname
      register: hostname
      become: no
    - name: Install Synapse repo
      copy:
        src: "{{ synapse_repo }}"
        dest: /etc/apt/sources.list.d/synapse.list
    - name: Install Synapse repo key
      apt_key:
        url: https://matrix.org/packages/debian/repo-key.asc
        state: present
    - name: Install Packages
      apt:
        name: "{{ packages }}"
        update_cache: yes
        state: installed
        install_recommends: no
    - name: Create ACME dir
      file:
        path: "/var/www/{{ federation_server }}"
        state: directory
        owner: www-data
        group: www-data
    - name: Create nginx log dir
      file:
        path: "/var/log/nginx/{{ federation_server }}"
        state: directory
        owner: www-data
        group: www-data
    - name: Setup nginx w/o HTTPS
      template:
        src: "{{ nginx_config }}"
        dest: "/etc/nginx/sites-available/{{ federation_server }}.conf"
    - name: Link nginx config
      file:
        path: "/etc/nginx/sites-enabled/{{ federation_server }}.conf"
        src: "/etc/nginx/sites-available/{{ federation_server }}.conf"
        state: link
    - name: Start nginx
      service:
        name: nginx
        state: started
        enabled: yes
    - name: Done part 1
      debug:
        msg: "Pre-Setup done, create a Key and Certificate and move them to /etc/ssl/certs/{{ federation_server }}.pem and /etc/ssl/certs/{{ federation_server }}.pem"