Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. - name: Ensure repository key for Synapse is in place
  2. apt_key: url=https://matrix.org/packages/debian/repo-key.asc state=present
  3. tags:
  4. - dependencies
  5. - name: Add Synapse repository
  6. apt_repository: repo="deb https://matrix.org/packages/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: Set firewall rules for Synapse
  66. ufw: rule=allow port={{ item }} proto=tcp
  67. with_items:
  68. - 8448 # matrix federation
  69. tags: ufw
  70. - name: Register new Synapse service
  71. systemd: name=matrix-synapse daemon_reload=yes enabled=yes
  72. - name: Start new Synapse instance
  73. service: name=matrix-synapse state=started
  74. - name: Create the Apache Matrix sites config files
  75. template:
  76. src=etc_apache2_sites-available_matrix.j2
  77. dest=/etc/apache2/sites-available/matrix_{{ item.name }}.conf
  78. owner=root
  79. group=root
  80. with_items: "{{ virtual_domains }}"
  81. notify: restart apache
  82. - name: Enable Apache sites (creates new sites-enabled symlinks)
  83. command: a2ensite matrix_{{ item }}.conf creates=/etc/apache2/sites-enabled/matrix_{{ item }}.conf
  84. notify: restart apache
  85. with_items: "{{ virtual_domains | json_query('[*].name') }}"
  86. - name: Create Matrix / Synapse accounts
  87. command: register_new_matrix_user -u {{ item.name }} -p {{ item.password }} -t support -a -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008
  88. with_items: "{{ synapse_accounts }}"
  89. ignore_errors: True