Move roles/matrix* to roles/custom/matrix*
This paves the way for installing other roles into `roles/galaxy` using `ansible-galaxy`, similar to how it's done in: - https://github.com/spantaleev/gitea-docker-ansible-deploy - https://github.com/spantaleev/nextcloud-docker-ansible-deploy In the near future, we'll be removing a lot of the shared role code from here and using upstream roles for it. Some of the core `matrix-*` roles have already been extracted out into other reusable roles: - https://github.com/devture/com.devture.ansible.role.postgres - https://github.com/devture/com.devture.ansible.role.systemd_docker_base - https://github.com/devture/com.devture.ansible.role.timesync - https://github.com/devture/com.devture.ansible.role.vars_preserver - https://github.com/devture/com.devture.ansible.role.playbook_runtime_messages - https://github.com/devture/com.devture.ansible.role.playbook_help We just need to migrate to those.
This commit is contained in:
104
roles/custom/matrix-ma1sd/templates/ma1sd.yaml.j2
Normal file
104
roles/custom/matrix-ma1sd/templates/ma1sd.yaml.j2
Normal file
@ -0,0 +1,104 @@
|
||||
#jinja2: lstrip_blocks: True
|
||||
matrix:
|
||||
domain: {{ matrix_domain }}
|
||||
v1: {{ matrix_ma1sd_v1_enabled|to_json }}
|
||||
v2: {{ matrix_ma1sd_v2_enabled|to_json }}
|
||||
|
||||
server:
|
||||
name: {{ matrix_server_fqn_matrix }}
|
||||
|
||||
key:
|
||||
path: /var/ma1sd/sign.key
|
||||
|
||||
storage:
|
||||
{% if matrix_ma1sd_database_engine == 'sqlite' %}
|
||||
backend: sqlite
|
||||
provider:
|
||||
sqlite:
|
||||
database: {{ matrix_ma1sd_sqlite_database_path_in_container|to_json }}
|
||||
{% elif matrix_ma1sd_database_engine == 'postgres' %}
|
||||
backend: postgresql
|
||||
provider:
|
||||
postgresql:
|
||||
database: //{{ matrix_ma1sd_database_hostname }}:{{ matrix_ma1sd_database_port }}/{{ matrix_ma1sd_database_name }}
|
||||
username: {{ matrix_ma1sd_database_username|to_json }}
|
||||
password: {{ matrix_ma1sd_database_password|to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_ma1sd_dns_overwrite_enabled %}
|
||||
dns:
|
||||
overwrite:
|
||||
homeserver:
|
||||
client:
|
||||
- name: {{ matrix_ma1sd_dns_overwrite_homeserver_client_name }}
|
||||
value: {{ matrix_ma1sd_dns_overwrite_homeserver_client_value }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_ma1sd_matrixorg_forwarding_enabled %}
|
||||
forward:
|
||||
servers: ['matrix-org']
|
||||
{% endif %}
|
||||
|
||||
threepid:
|
||||
medium:
|
||||
email:
|
||||
identity:
|
||||
from: {{ matrix_ma1sd_threepid_medium_email_identity_from }}
|
||||
connectors:
|
||||
smtp:
|
||||
host: {{ matrix_ma1sd_threepid_medium_email_connectors_smtp_host }}
|
||||
port: {{ matrix_ma1sd_threepid_medium_email_connectors_smtp_port }}
|
||||
tls: {{ matrix_ma1sd_threepid_medium_email_connectors_smtp_tls }}
|
||||
login: {{ matrix_ma1sd_threepid_medium_email_connectors_smtp_login }}
|
||||
password: {{ matrix_ma1sd_threepid_medium_email_connectors_smtp_password }}
|
||||
{% if matrix_ma1sd_threepid_medium_email_custom_templates_enabled %}
|
||||
generators:
|
||||
template:
|
||||
{% if matrix_ma1sd_threepid_medium_email_custom_invite_template %}
|
||||
invite: '/etc/ma1sd/invite-template.eml'
|
||||
{% endif %}
|
||||
{% if matrix_ma1sd_threepid_medium_email_custom_session_validation_template or matrix_ma1sd_threepid_medium_email_custom_session_unbind_notification_template %}
|
||||
session:
|
||||
{% if matrix_ma1sd_threepid_medium_email_custom_session_validation_template %}
|
||||
validation: '/etc/ma1sd/validate-template.eml'
|
||||
{% endif %}
|
||||
{% if matrix_ma1sd_threepid_medium_email_custom_session_unbind_notification_template %}
|
||||
unbind:
|
||||
notification: '/etc/ma1sd/unbind-notification.eml'
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if matrix_ma1sd_threepid_medium_email_custom_matrixid_template %}
|
||||
generic:
|
||||
matrixId: '/etc/ma1sd/mxid-template.eml'
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_ma1sd_view_session_custom_templates_enabled %}
|
||||
view:
|
||||
session:
|
||||
onTokenSubmit:
|
||||
{% if matrix_ma1sd_view_session_custom_onTokenSubmit_success_template %}
|
||||
success: '/etc/ma1sd/tokenSubmitSuccess.html'
|
||||
{% endif %}
|
||||
{% if matrix_ma1sd_view_session_custom_onTokenSubmit_failure_template %}
|
||||
failure: '/etc/ma1sd/tokenSubmitFailure.html'
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_ma1sd_hashing_enabled %}
|
||||
hashing:
|
||||
enabled: true # enable or disable the hash lookup MSC2140 (default is false)
|
||||
pepperLength: 20 # length of the pepper value (default is 20)
|
||||
rotationPolicy: per_requests # or `per_seconds` how often the hashes will be updating
|
||||
hashStorageType: sql # or `in_memory` where the hashes will be stored
|
||||
algorithms:
|
||||
- none # the same as v1 bulk lookup
|
||||
- sha256 # hash the 3PID and pepper.
|
||||
delay: 2m # how often hashes will be updated if rotation policy = per_seconds (default is 10s)
|
||||
requests: 10
|
||||
{% endif %}
|
||||
|
||||
synapseSql:
|
||||
enabled: {{ matrix_ma1sd_synapsesql_enabled|to_json }}
|
||||
type: {{ matrix_ma1sd_synapsesql_type|to_json }}
|
||||
connection: {{ matrix_ma1sd_synapsesql_connection|to_json }}
|
@ -0,0 +1,48 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix ma1sd Identity server
|
||||
{% for service in matrix_ma1sd_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_ma1sd_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-ma1sd 2>/dev/null || true'
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-ma1sd 2>/dev/null || true'
|
||||
|
||||
# ma1sd writes an SQLite shared library (libsqlitejdbc.so) to /tmp and executes it from there,
|
||||
# so /tmp needs to be mounted with an exec option.
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-ma1sd \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--tmpfs=/tmp:rw,exec,nosuid,size=10m \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_ma1sd_container_http_host_bind_port %}
|
||||
-p {{ matrix_ma1sd_container_http_host_bind_port }}:{{ matrix_ma1sd_container_port }} \
|
||||
{% endif %}
|
||||
{% if matrix_ma1sd_verbose_logging %}
|
||||
-e MA1SD_LOG_LEVEL=debug \
|
||||
{% endif %}
|
||||
--mount type=bind,src={{ matrix_ma1sd_config_path }},dst=/etc/ma1sd,ro \
|
||||
--mount type=bind,src={{ matrix_ma1sd_data_path }},dst=/var/ma1sd \
|
||||
{% for arg in matrix_ma1sd_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_ma1sd_docker_image }}
|
||||
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-ma1sd 2>/dev/null || true'
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-ma1sd 2>/dev/null || true'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-ma1sd
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user