Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

synapse.yml 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. - name: Ensure repository key for Synapse is in place
  2. apt_key: url=https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg state=present
  3. tags:
  4. - dependencies
  5. - name: Add Synapse repository
  6. apt_repository: repo="deb https://packages.matrix.org/debian/ {{ ansible_distribution_release }} main"
  7. tags:
  8. - dependencies
  9. - name: Install Synapse and dependencies from official repository
  10. apt:
  11. name: "{{ packages }}"
  12. state: present
  13. update_cache: yes
  14. vars:
  15. packages:
  16. - python-psycopg2
  17. - matrix-synapse
  18. tags:
  19. - dependencies
  20. - name: Add Synapse user to ssl-cert group
  21. user: name=matrix-synapse group=ssl-cert
  22. - name: Create Synapse data directory
  23. file: state=directory path=/data/{{ item }} owner=matrix-synapse group=root
  24. with_items:
  25. - matrix-synapse
  26. - matrix-synapse/uploads
  27. - matrix-synapse/media
  28. - name: Configure Synapse homeserver
  29. template:
  30. src=etc_matrix-synapse_homeserver.j2
  31. dest=/etc/matrix-synapse/homeserver.yaml
  32. owner=matrix-synapse
  33. group=root
  34. notify: restart synapse
  35. - name: Configure Synapse server name
  36. template:
  37. src=etc_matrix-synapse_conf.d_server_name.j2
  38. dest=/etc/matrix-synapse/conf.d/server_name.yaml
  39. owner=matrix-synapse
  40. group=root
  41. notify: restart synapse
  42. - name: Add Synapse postgres user
  43. postgresql_user:
  44. login_host=localhost
  45. login_user={{ db_admin_username }}
  46. login_password="{{ db_admin_password }}"
  47. name={{ synapse_db_username }}
  48. password="{{ synapse_db_password }}"
  49. encrypted=yes
  50. state=present
  51. - name: Create Synapse database
  52. postgresql_db:
  53. login_host=localhost
  54. login_user={{ db_admin_username }}
  55. login_password="{{ db_admin_password }}"
  56. name={{ synapse_db_database }}
  57. state=present
  58. owner={{ synapse_db_username }}
  59. encoding='UTF8'
  60. lc_collate='C'
  61. lc_ctype='C'
  62. template='template0'
  63. - name: Add cert postrenew task
  64. copy: src=etc_letsencrypt_postrenew_synapse.sh dest=/etc/letsencrypt/postrenew/synapse.sh mode=0755
  65. - name: Register new Synapse service
  66. systemd: name=matrix-synapse daemon_reload=yes enabled=yes
  67. - name: Start new Synapse instance
  68. service: name=matrix-synapse state=started
  69. - name: Create matrix well-known directory
  70. file: state=directory path=/var/www/well-known/matrix owner=www-data group=www-data
  71. - name: Add redirect to well-known
  72. template:
  73. src=var_www_well-known_matrix_server.j2
  74. dest=/var/www/well-known/matrix/server
  75. owner=www-data
  76. group=www-data
  77. - name: Create the Apache Matrix sites config files
  78. template:
  79. src=etc_apache2_sites-available_matrix.j2
  80. dest=/etc/apache2/sites-available/matrix_{{ item.name }}.conf
  81. owner=root
  82. group=root
  83. with_items: "{{ virtual_domains }}"
  84. notify: restart apache
  85. - name: Enable Apache sites (creates new sites-enabled symlinks)
  86. command: a2ensite matrix_{{ item }}.conf creates=/etc/apache2/sites-enabled/matrix_{{ item }}.conf
  87. notify: restart apache
  88. with_items: "{{ virtual_domains | json_query('[*].name') }}"
  89. - name: Create Matrix / Synapse accounts
  90. command: register_new_matrix_user -u {{ item.name }} -p {{ item.password }} -t support -a -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008
  91. with_items: "{{ synapse_accounts }}"
  92. ignore_errors: True