| @@ -296,46 +296,6 @@ matrix_mautrix_facebook_database_password: "{{ matrix_synapse_macaroon_secret_ke | |||||
| ###################################################################### | ###################################################################### | ||||
| ###################################################################### | |||||
| # | |||||
| # matrix-bridge-mautrix-hangouts | |||||
| # | |||||
| ###################################################################### | |||||
| # We don't enable bridges by default. | |||||
| matrix_mautrix_hangouts_enabled: false | |||||
| matrix_mautrix_hangouts_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}" | |||||
| matrix_mautrix_hangouts_systemd_required_services_list: | | |||||
| {{ | |||||
| ['docker.service'] | |||||
| + | |||||
| (['matrix-synapse.service'] if matrix_synapse_enabled else []) | |||||
| + | |||||
| (['matrix-postgres.service'] if matrix_postgres_enabled else []) | |||||
| + | |||||
| (['matrix-nginx-proxy.service'] if matrix_nginx_proxy_enabled else []) | |||||
| }} | |||||
| matrix_mautrix_hangouts_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'ho.as.token') | to_uuid }}" | |||||
| matrix_mautrix_hangouts_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'ho.hs.token') | to_uuid }}" | |||||
| matrix_mautrix_hangouts_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:9007' }}" | |||||
| matrix_mautrix_hangouts_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}" | |||||
| # Postgres is the default, except if not using `matrix_postgres` (internal postgres) | |||||
| matrix_mautrix_hangouts_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}" | |||||
| matrix_mautrix_hangouts_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mau.hangouts.db') | to_uuid }}" | |||||
| ###################################################################### | |||||
| # | |||||
| # /matrix-bridge-mautrix-hangouts | |||||
| # | |||||
| ###################################################################### | |||||
| ###################################################################### | ###################################################################### | ||||
| # | # | ||||
| # matrix-bridge-mautrix-googlechat | # matrix-bridge-mautrix-googlechat | ||||
| @@ -1461,12 +1421,6 @@ matrix_postgres_additional_databases: | | |||||
| 'password': matrix_mautrix_facebook_database_password, | 'password': matrix_mautrix_facebook_database_password, | ||||
| }] if (matrix_mautrix_facebook_enabled and matrix_mautrix_facebook_database_engine == 'postgres' and matrix_mautrix_facebook_database_hostname == 'matrix-postgres') else []) | }] if (matrix_mautrix_facebook_enabled and matrix_mautrix_facebook_database_engine == 'postgres' and matrix_mautrix_facebook_database_hostname == 'matrix-postgres') else []) | ||||
| + | + | ||||
| ([{ | |||||
| 'name': matrix_mautrix_hangouts_database_name, | |||||
| 'username': matrix_mautrix_hangouts_database_username, | |||||
| 'password': matrix_mautrix_hangouts_database_password, | |||||
| }] if (matrix_mautrix_hangouts_enabled and matrix_mautrix_hangouts_database_engine == 'postgres' and matrix_mautrix_hangouts_database_hostname == 'matrix-postgres') else []) | |||||
| + | |||||
| ([{ | ([{ | ||||
| 'name': matrix_mautrix_googlechat_database_name, | 'name': matrix_mautrix_googlechat_database_name, | ||||
| 'username': matrix_mautrix_googlechat_database_username, | 'username': matrix_mautrix_googlechat_database_username, | ||||
| @@ -1,115 +0,0 @@ | |||||
| # mautrix-hangouts is a Matrix <-> Hangouts bridge | |||||
| # See: https://github.com/mautrix/hangouts | |||||
| matrix_mautrix_hangouts_enabled: true | |||||
| matrix_mautrix_hangouts_container_image_self_build: false | |||||
| matrix_mautrix_hangouts_container_image_self_build_repo: "https://github.com/mautrix/hangouts.git" | |||||
| matrix_mautrix_hangouts_version: latest | |||||
| # See: https://mau.dev/mautrix/hangouts/container_registry | |||||
| matrix_mautrix_hangouts_docker_image: "{{ matrix_mautrix_hangouts_docker_image_name_prefix }}mautrix/hangouts:{{ matrix_mautrix_hangouts_version }}" | |||||
| matrix_mautrix_hangouts_docker_image_name_prefix: "{{ 'localhost/' if matrix_mautrix_hangouts_container_image_self_build else 'dock.mau.dev/' }}" | |||||
| matrix_mautrix_hangouts_docker_image_force_pull: "{{ matrix_mautrix_hangouts_docker_image.endswith(':latest') }}" | |||||
| matrix_mautrix_hangouts_base_path: "{{ matrix_base_data_path }}/mautrix-hangouts" | |||||
| matrix_mautrix_hangouts_config_path: "{{ matrix_mautrix_hangouts_base_path }}/config" | |||||
| matrix_mautrix_hangouts_data_path: "{{ matrix_mautrix_hangouts_base_path }}/data" | |||||
| matrix_mautrix_hangouts_docker_src_files_path: "{{ matrix_mautrix_hangouts_base_path }}/docker-src" | |||||
| matrix_mautrix_hangouts_public_endpoint: '/mautrix-hangouts' | |||||
| matrix_mautrix_hangouts_homeserver_address: "{{ matrix_homeserver_container_url }}" | |||||
| matrix_mautrix_hangouts_homeserver_domain: '{{ matrix_domain }}' | |||||
| matrix_mautrix_hangouts_appservice_address: 'http://matrix-mautrix-hangouts:8080' | |||||
| # Controls whether the matrix-mautrix-hangouts container exposes its HTTP port (tcp/8080 in the container). | |||||
| # | |||||
| # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9007"), or empty string to not expose. | |||||
| matrix_mautrix_hangouts_container_http_host_bind_port: '' | |||||
| # A list of extra arguments to pass to the container | |||||
| matrix_mautrix_hangouts_container_extra_arguments: [] | |||||
| # List of systemd services that matrix-mautrix-hangouts.service depends on. | |||||
| matrix_mautrix_hangouts_systemd_required_services_list: ['docker.service'] | |||||
| # List of systemd services that matrix-mautrix-hangouts.service wants | |||||
| matrix_mautrix_hangouts_systemd_wanted_services_list: [] | |||||
| matrix_mautrix_hangouts_appservice_token: '' | |||||
| matrix_mautrix_hangouts_homeserver_token: '' | |||||
| # Database-related configuration fields. | |||||
| # | |||||
| # To use SQLite, stick to these defaults. | |||||
| # | |||||
| # To use Postgres: | |||||
| # - change the engine (`matrix_mautrix_hangouts_database_engine: 'postgres'`) | |||||
| # - adjust your database credentials via the `matrix_mautrix_hangouts_postgres_*` variables | |||||
| matrix_mautrix_hangouts_database_engine: 'sqlite' | |||||
| matrix_mautrix_hangouts_sqlite_database_path_local: "{{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db" | |||||
| matrix_mautrix_hangouts_sqlite_database_path_in_container: "/data/mautrix-hangouts.db" | |||||
| matrix_mautrix_hangouts_database_username: 'matrix_mautrix_hangouts' | |||||
| matrix_mautrix_hangouts_database_password: 'some-password' | |||||
| matrix_mautrix_hangouts_database_hostname: 'matrix-postgres' | |||||
| matrix_mautrix_hangouts_database_port: 5432 | |||||
| matrix_mautrix_hangouts_database_name: 'matrix_mautrix_hangouts' | |||||
| matrix_mautrix_hangouts_database_connection_string: 'postgres://{{ matrix_mautrix_hangouts_database_username }}:{{ matrix_mautrix_hangouts_database_password }}@{{ matrix_mautrix_hangouts_database_hostname }}:{{ matrix_mautrix_hangouts_database_port }}/{{ matrix_mautrix_hangouts_database_name }}' | |||||
| matrix_mautrix_hangouts_appservice_database: "{{ | |||||
| { | |||||
| 'sqlite': ('sqlite:///' + matrix_mautrix_hangouts_sqlite_database_path_in_container), | |||||
| 'postgres': matrix_mautrix_hangouts_database_connection_string, | |||||
| }[matrix_mautrix_hangouts_database_engine] | |||||
| }}" | |||||
| # Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth). | |||||
| matrix_mautrix_hangouts_login_shared_secret: '' | |||||
| matrix_mautrix_hangouts_appservice_bot_username: hangoutsbot | |||||
| # Default configuration template which covers the generic use case. | |||||
| # You can customize it by controlling the various variables inside it. | |||||
| # | |||||
| # For a more advanced customization, you can extend the default (see `matrix_mautrix_hangouts_configuration_extension_yaml`) | |||||
| # or completely replace this variable with your own template. | |||||
| matrix_mautrix_hangouts_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" | |||||
| matrix_mautrix_hangouts_configuration_extension_yaml: | | |||||
| # Your custom YAML configuration goes here. | |||||
| # This configuration extends the default starting configuration (`matrix_mautrix_hangouts_configuration_yaml`). | |||||
| # | |||||
| # You can override individual variables from the default configuration, or introduce new ones. | |||||
| # | |||||
| # If you need something more special, you can take full control by | |||||
| # completely redefining `matrix_mautrix_hangouts_configuration_yaml`. | |||||
| matrix_mautrix_hangouts_configuration_extension: "{{ matrix_mautrix_hangouts_configuration_extension_yaml|from_yaml if matrix_mautrix_hangouts_configuration_extension_yaml|from_yaml is mapping else {} }}" | |||||
| # Holds the final configuration (a combination of the default and its extension). | |||||
| # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_hangouts_configuration_yaml`. | |||||
| matrix_mautrix_hangouts_configuration: "{{ matrix_mautrix_hangouts_configuration_yaml|from_yaml|combine(matrix_mautrix_hangouts_configuration_extension, recursive=True) }}" | |||||
| matrix_mautrix_hangouts_registration_yaml: | | |||||
| id: hangouts | |||||
| as_token: "{{ matrix_mautrix_hangouts_appservice_token }}" | |||||
| hs_token: "{{ matrix_mautrix_hangouts_homeserver_token }}" | |||||
| namespaces: | |||||
| users: | |||||
| - exclusive: true | |||||
| regex: '^@hangouts_.+:{{ matrix_mautrix_hangouts_homeserver_domain|regex_escape }}$' | |||||
| - exclusive: true | |||||
| regex: '^@{{ matrix_mautrix_hangouts_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_hangouts_homeserver_domain|regex_escape }}$' | |||||
| url: {{ matrix_mautrix_hangouts_appservice_address }} | |||||
| # See https://github.com/mautrix/signal/issues/43 | |||||
| sender_localpart: _bot_{{ matrix_mautrix_hangouts_appservice_bot_username }} | |||||
| rate_limited: false | |||||
| de.sorunome.msc2409.push_ephemeral: true | |||||
| matrix_mautrix_hangouts_registration: "{{ matrix_mautrix_hangouts_registration_yaml|from_yaml }}" | |||||
| @@ -1,69 +0,0 @@ | |||||
| # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 | |||||
| # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 | |||||
| - name: Fail if trying to self-build on Ansible < 2.8 | |||||
| fail: | |||||
| msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" | |||||
| when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_hangouts_container_image_self_build and matrix_mautrix_hangouts_enabled" | |||||
| - set_fact: | |||||
| matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-hangouts.service'] }}" | |||||
| when: matrix_mautrix_hangouts_enabled|bool | |||||
| # If the matrix-synapse role is not used, these variables may not exist. | |||||
| - set_fact: | |||||
| matrix_synapse_container_extra_arguments: > | |||||
| {{ matrix_synapse_container_extra_arguments|default([]) }} | |||||
| + | |||||
| ["--mount type=bind,src={{ matrix_mautrix_hangouts_config_path }}/registration.yaml,dst=/matrix-mautrix-hangouts-registration.yaml,ro"] | |||||
| matrix_synapse_app_service_config_files: > | |||||
| {{ matrix_synapse_app_service_config_files|default([]) }} | |||||
| + | |||||
| {{ ["/matrix-mautrix-hangouts-registration.yaml"] }} | |||||
| when: matrix_mautrix_hangouts_enabled|bool | |||||
| - block: | |||||
| - name: Fail if matrix-nginx-proxy role already executed | |||||
| fail: | |||||
| msg: >- | |||||
| Trying to append Mautrix Hangouts's reverse-proxying configuration to matrix-nginx-proxy, | |||||
| but it's pointless since the matrix-nginx-proxy role had already executed. | |||||
| To fix this, please change the order of roles in your plabook, | |||||
| so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-hangouts role. | |||||
| when: matrix_nginx_proxy_role_executed|default(False)|bool | |||||
| - name: Generate Mautrix Hangouts proxying configuration for matrix-nginx-proxy | |||||
| set_fact: | |||||
| matrix_mautrix_hangouts_matrix_nginx_proxy_configuration: | | |||||
| location {{ matrix_mautrix_hangouts_public_endpoint }} { | |||||
| {% if matrix_nginx_proxy_enabled|default(False) %} | |||||
| {# Use the embedded DNS resolver in Docker containers to discover the service #} | |||||
| resolver 127.0.0.11 valid=5s; | |||||
| set $backend "matrix-mautrix-hangouts:8080"; | |||||
| proxy_pass http://$backend; | |||||
| {% else %} | |||||
| {# Generic configuration for use outside of our container setup #} | |||||
| proxy_pass http://127.0.0.1:9007; | |||||
| {% endif %} | |||||
| } | |||||
| - name: Register Mautrix Hangouts proxying configuration with matrix-nginx-proxy | |||||
| set_fact: | |||||
| matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | | |||||
| {{ | |||||
| matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) | |||||
| + | |||||
| [matrix_mautrix_hangouts_matrix_nginx_proxy_configuration] | |||||
| }} | |||||
| tags: | |||||
| - always | |||||
| when: matrix_mautrix_hangouts_enabled|bool | |||||
| - name: Warn about reverse-proxying if matrix-nginx-proxy not used | |||||
| debug: | |||||
| msg: >- | |||||
| NOTE: You've enabled the Mautrix Hangouts bridge but are not using the matrix-nginx-proxy | |||||
| reverse proxy. | |||||
| Please make sure that you're proxying the `{{ matrix_mautrix_hangouts_public_endpoint }}` | |||||
| URL endpoint to the matrix-mautrix-hangouts container. | |||||
| You can expose the container's port using the `matrix_mautrix_hangouts_container_http_host_bind_port` variable. | |||||
| when: "matrix_mautrix_hangouts_enabled|bool and (matrix_nginx_proxy_enabled is not defined or matrix_nginx_proxy_enabled|bool == false)" | |||||
| @@ -1,21 +0,0 @@ | |||||
| - import_tasks: "{{ role_path }}/tasks/init.yml" | |||||
| tags: | |||||
| - always | |||||
| - import_tasks: "{{ role_path }}/tasks/validate_config.yml" | |||||
| when: "run_setup|bool and matrix_mautrix_hangouts_enabled|bool" | |||||
| tags: | |||||
| - setup-all | |||||
| - setup-mautrix-hangouts | |||||
| - import_tasks: "{{ role_path }}/tasks/setup_install.yml" | |||||
| when: "run_setup|bool and matrix_mautrix_hangouts_enabled|bool" | |||||
| tags: | |||||
| - setup-all | |||||
| - setup-mautrix-hangouts | |||||
| - import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" | |||||
| when: "run_setup|bool and not matrix_mautrix_hangouts_enabled|bool" | |||||
| tags: | |||||
| - setup-all | |||||
| - setup-mautrix-hangouts | |||||
| @@ -1,128 +0,0 @@ | |||||
| --- | |||||
| # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. | |||||
| # We don't want to fail in such cases. | |||||
| - name: Fail if matrix-synapse role already executed | |||||
| fail: | |||||
| msg: >- | |||||
| The matrix-bridge-mautrix-hangouts role needs to execute before the matrix-synapse role. | |||||
| when: "matrix_synapse_role_executed|default(False)" | |||||
| - set_fact: | |||||
| matrix_mautrix_hangouts_requires_restart: false | |||||
| - block: | |||||
| - name: Check if an SQLite database already exists | |||||
| stat: | |||||
| path: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}" | |||||
| register: matrix_mautrix_hangouts_sqlite_database_path_local_stat_result | |||||
| - block: | |||||
| - set_fact: | |||||
| matrix_postgres_db_migration_request: | |||||
| src: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}" | |||||
| dst: "{{ matrix_mautrix_hangouts_database_connection_string }}" | |||||
| caller: "{{ role_path|basename }}" | |||||
| engine_variable_name: 'matrix_mautrix_hangouts_database_engine' | |||||
| engine_old: 'sqlite' | |||||
| systemd_services_to_stop: ['matrix-mautrix-hangouts.service'] | |||||
| - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" | |||||
| - set_fact: | |||||
| matrix_mautrix_hangouts_requires_restart: true | |||||
| when: "matrix_mautrix_hangouts_sqlite_database_path_local_stat_result.stat.exists|bool" | |||||
| when: "matrix_mautrix_hangouts_database_engine == 'postgres'" | |||||
| - name: Ensure Mautrix Hangouts image is pulled | |||||
| docker_image: | |||||
| name: "{{ matrix_mautrix_hangouts_docker_image }}" | |||||
| source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | |||||
| force_source: "{{ matrix_mautrix_hangouts_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | |||||
| force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_hangouts_docker_image_force_pull }}" | |||||
| when: not matrix_mautrix_hangouts_container_image_self_build | |||||
| - name: Ensure Mautrix Hangouts paths exist | |||||
| file: | |||||
| path: "{{ item.path }}" | |||||
| state: directory | |||||
| mode: 0750 | |||||
| owner: "{{ matrix_user_username }}" | |||||
| group: "{{ matrix_user_groupname }}" | |||||
| with_items: | |||||
| - { path: "{{ matrix_mautrix_hangouts_base_path }}", when: true } | |||||
| - { path: "{{ matrix_mautrix_hangouts_config_path }}", when: true } | |||||
| - { path: "{{ matrix_mautrix_hangouts_data_path }}", when: true } | |||||
| - { path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}", when: "{{ matrix_mautrix_hangouts_container_image_self_build }}" } | |||||
| when: "item.when|bool" | |||||
| - name: Ensure Mautrix Hangots repository is present on self build | |||||
| git: | |||||
| repo: "{{ matrix_mautrix_hangouts_container_image_self_build_repo }}" | |||||
| dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" | |||||
| force: "yes" | |||||
| register: matrix_mautrix_hangouts_git_pull_results | |||||
| when: "matrix_mautrix_hangouts_container_image_self_build|bool" | |||||
| - name: Ensure Mautrix Hangouts Docker image is built | |||||
| docker_image: | |||||
| name: "{{ matrix_mautrix_hangouts_docker_image }}" | |||||
| source: build | |||||
| force_source: "{{ matrix_mautrix_hangouts_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | |||||
| force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_hangouts_git_pull_results.changed }}" | |||||
| build: | |||||
| dockerfile: Dockerfile | |||||
| path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" | |||||
| pull: yes | |||||
| when: "matrix_mautrix_hangouts_container_image_self_build|bool" | |||||
| - name: Check if an old database file already exists | |||||
| stat: | |||||
| path: "{{ matrix_mautrix_hangouts_base_path }}/mautrix-hangouts.db" | |||||
| register: matrix_mautrix_hangouts_stat_database | |||||
| - name: (Data relocation) Ensure matrix-mautrix-hangouts.service is stopped | |||||
| service: | |||||
| name: matrix-mautrix-hangouts | |||||
| state: stopped | |||||
| daemon_reload: yes | |||||
| failed_when: false | |||||
| when: "matrix_mautrix_hangouts_stat_database.stat.exists" | |||||
| - name: (Data relocation) Move mautrix-hangouts database file to ./data directory | |||||
| command: "mv {{ matrix_mautrix_hangouts_base_path }}/mautrix-hangouts.db {{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db" | |||||
| when: "matrix_mautrix_hangouts_stat_database.stat.exists" | |||||
| - name: Ensure mautrix-hangouts config.yaml installed | |||||
| copy: | |||||
| content: "{{ matrix_mautrix_hangouts_configuration|to_nice_yaml }}" | |||||
| dest: "{{ matrix_mautrix_hangouts_config_path }}/config.yaml" | |||||
| mode: 0644 | |||||
| owner: "{{ matrix_user_username }}" | |||||
| group: "{{ matrix_user_groupname }}" | |||||
| - name: Ensure mautrix-hangouts registration.yaml installed | |||||
| copy: | |||||
| content: "{{ matrix_mautrix_hangouts_registration|to_nice_yaml }}" | |||||
| dest: "{{ matrix_mautrix_hangouts_config_path }}/registration.yaml" | |||||
| mode: 0644 | |||||
| owner: "{{ matrix_user_username }}" | |||||
| group: "{{ matrix_user_groupname }}" | |||||
| - name: Ensure matrix-mautrix-hangouts.service installed | |||||
| template: | |||||
| src: "{{ role_path }}/templates/systemd/matrix-mautrix-hangouts.service.j2" | |||||
| dest: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" | |||||
| mode: 0644 | |||||
| register: matrix_mautrix_hangouts_systemd_service_result | |||||
| - name: Ensure systemd reloaded after matrix-mautrix-hangouts.service installation | |||||
| service: | |||||
| daemon_reload: yes | |||||
| when: "matrix_mautrix_hangouts_systemd_service_result.changed" | |||||
| - name: Ensure matrix-mautrix-hangouts.service restarted, if necessary | |||||
| service: | |||||
| name: "matrix-mautrix-hangouts.service" | |||||
| state: restarted | |||||
| when: "matrix_mautrix_hangouts_requires_restart|bool" | |||||
| @@ -1,24 +0,0 @@ | |||||
| --- | |||||
| - name: Check existence of matrix-mautrix-hangouts service | |||||
| stat: | |||||
| path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" | |||||
| register: matrix_mautrix_hangouts_service_stat | |||||
| - name: Ensure matrix-mautrix-hangouts is stopped | |||||
| service: | |||||
| name: matrix-mautrix-hangouts | |||||
| state: stopped | |||||
| daemon_reload: yes | |||||
| when: "matrix_mautrix_hangouts_service_stat.stat.exists" | |||||
| - name: Ensure matrix-mautrix-hangouts.service doesn't exist | |||||
| file: | |||||
| path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" | |||||
| state: absent | |||||
| when: "matrix_mautrix_hangouts_service_stat.stat.exists" | |||||
| - name: Ensure systemd reloaded after matrix-mautrix-hangouts.service removal | |||||
| service: | |||||
| daemon_reload: yes | |||||
| when: "matrix_mautrix_hangouts_service_stat.stat.exists" | |||||
| @@ -1,14 +0,0 @@ | |||||
| --- | |||||
| - name: Fail if required settings not defined | |||||
| fail: | |||||
| msg: >- | |||||
| You need to define a required configuration setting (`{{ item }}`). | |||||
| when: "vars[item] == ''" | |||||
| with_items: | |||||
| - "matrix_mautrix_hangouts_public_endpoint" | |||||
| - "matrix_mautrix_hangouts_appservice_token" | |||||
| - "matrix_mautrix_hangouts_homeserver_token" | |||||
| - debug: | |||||
| msg: | |||||
| - '`matrix_mautrix_hangouts_homeserver_domain` == {{ matrix_mautrix_hangouts_homeserver_domain }}' | |||||
| @@ -1,145 +0,0 @@ | |||||
| #jinja2: lstrip_blocks: "True" | |||||
| # Homeserver details | |||||
| homeserver: | |||||
| # The address that this appservice can use to connect to the homeserver. | |||||
| address: {{ matrix_mautrix_hangouts_homeserver_address }} | |||||
| # The domain of the homeserver (for MXIDs, etc). | |||||
| domain: {{ matrix_mautrix_hangouts_homeserver_domain }} | |||||
| # Whether or not to verify the SSL certificate of the homeserver. | |||||
| # Only applies if address starts with https:// | |||||
| verify_ssl: true | |||||
| # Application service host/registration related details | |||||
| # Changing these values requires regeneration of the registration. | |||||
| appservice: | |||||
| # The address that the homeserver can use to connect to this appservice. | |||||
| address: {{ matrix_mautrix_hangouts_appservice_address }} | |||||
| # The hostname and port where this appservice should listen. | |||||
| hostname: 0.0.0.0 | |||||
| port: 8080 | |||||
| # The maximum body size of appservice API requests (from the homeserver) in mebibytes | |||||
| # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s | |||||
| max_body_size: 1 | |||||
| # The full URI to the database. SQLite and Postgres are fully supported. | |||||
| # Other DBMSes supported by SQLAlchemy may or may not work. | |||||
| # Format examples: | |||||
| # SQLite: sqlite:///filename.db | |||||
| # Postgres: postgres://username:password@hostname/dbname | |||||
| database: {{ matrix_mautrix_hangouts_appservice_database|to_json }} | |||||
| # The unique ID of this appservice. | |||||
| id: hangouts | |||||
| # Username of the appservice bot. | |||||
| bot_username: {{ matrix_mautrix_hangouts_appservice_bot_username|to_json }} | |||||
| # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty | |||||
| # to leave display name/avatar as-is. | |||||
| bot_displayname: Hangouts bridge bot | |||||
| bot_avatar: mxc://maunium.net/FBXZnpfORkBEruORbikmleAy | |||||
| # Authentication tokens for AS <-> HS communication. | |||||
| as_token: "{{ matrix_mautrix_hangouts_appservice_token }}" | |||||
| hs_token: "{{ matrix_mautrix_hangouts_homeserver_token }}" | |||||
| # Bridge config | |||||
| bridge: | |||||
| # Localpart template of MXIDs for Hangouts users. | |||||
| # {userid} is replaced with the user ID of the Hangouts user. | |||||
| username_template: "hangouts_{userid}" | |||||
| # Displayname template for Hangouts users. | |||||
| # {displayname} is replaced with the display name of the Hangouts user | |||||
| # as defined below in displayname_preference. | |||||
| # Keys available for displayname_preference are also available here. | |||||
| displayname_template: '{full_name} (Hangouts)' | |||||
| # Available keys: | |||||
| # "name" (full name) | |||||
| # "first_name" | |||||
| # "last_name" | |||||
| # "nickname" | |||||
| # "own_nickname" (user-specific!) | |||||
| displayname_preference: | |||||
| - name | |||||
| # The prefix for commands. Only required in non-management rooms. | |||||
| command_prefix: "!HO" | |||||
| # Number of chats to sync (and create portals for) on startup/login. | |||||
| # Maximum 20, set 0 to disable automatic syncing. | |||||
| initial_chat_sync: 20 | |||||
| # Whether or not the Hangouts users of logged in Matrix users should be | |||||
| # invited to private chats when the user sends a message from another client. | |||||
| invite_own_puppet_to_pm: false | |||||
| # Whether or not to use /sync to get presence, read receipts and typing notifications when using | |||||
| # your own Matrix account as the Matrix puppet for your Hangouts account. | |||||
| sync_with_custom_puppets: true | |||||
| # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth | |||||
| # | |||||
| # If set, custom puppets will be enabled automatically for local users | |||||
| # instead of users having to find an access token and run `login-matrix` | |||||
| # manually. | |||||
| login_shared_secret: {{ matrix_mautrix_hangouts_login_shared_secret|to_json }} | |||||
| # Whether or not to update avatars when syncing all contacts at startup. | |||||
| update_avatar_initial_sync: true | |||||
| # End-to-bridge encryption support options. These require matrix-nio to be installed with pip | |||||
| # and login_shared_secret to be configured in order to get a device for the bridge bot. | |||||
| # | |||||
| # Additionally, https://github.com/matrix-org/synapse/pull/5758 is required if using a normal | |||||
| # application service. | |||||
| encryption: | |||||
| # Allow encryption, work in group chat rooms with e2ee enabled | |||||
| allow: false | |||||
| # Default to encryption, force-enable encryption in all portals the bridge creates | |||||
| # This will cause the bridge bot to be in private chats for the encryption to work properly. | |||||
| default: false | |||||
| # Public website and API configs | |||||
| web: | |||||
| # Auth server config | |||||
| auth: | |||||
| # Publicly accessible base URL for the login endpoints. | |||||
| # The prefix below is not implicitly added. This URL and all subpaths should be proxied | |||||
| # or otherwise pointed to the appservice's webserver to the path specified below (prefix). | |||||
| # This path should usually include a trailing slash. | |||||
| # Internal prefix in the appservice web server for the login endpoints. | |||||
| public: "{{ matrix_homeserver_url }}{{ matrix_mautrix_hangouts_public_endpoint }}/login" | |||||
| prefix: "{{ matrix_mautrix_hangouts_public_endpoint }}/login" | |||||
| # Permissions for using the bridge. | |||||
| # Permitted values: | |||||
| # user - Use the bridge with puppeting. | |||||
| # admin - Use and administrate the bridge. | |||||
| # Permitted keys: | |||||
| # * - All Matrix users | |||||
| # domain - All users on that homeserver | |||||
| # mxid - Specific user | |||||
| permissions: | |||||
| '{{ matrix_mautrix_hangouts_homeserver_domain }}': user | |||||
| # Python logging configuration. | |||||
| # | |||||
| # See section 16.7.2 of the Python documentation for more info: | |||||
| # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema | |||||
| logging: | |||||
| version: 1 | |||||
| formatters: | |||||
| colored: | |||||
| (): mautrix_hangouts.util.ColorFormatter | |||||
| format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s" | |||||
| normal: | |||||
| format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s" | |||||
| handlers: | |||||
| console: | |||||
| class: logging.StreamHandler | |||||
| formatter: colored | |||||
| loggers: | |||||
| mau: | |||||
| level: DEBUG | |||||
| hangups: | |||||
| level: DEBUG | |||||
| aiohttp: | |||||
| level: INFO | |||||
| root: | |||||
| level: DEBUG | |||||
| handlers: [console] | |||||
| @@ -1,54 +0,0 @@ | |||||
| #jinja2: lstrip_blocks: "True" | |||||
| [Unit] | |||||
| Description=Matrix Mautrix Hangouts bridge | |||||
| {% for service in matrix_mautrix_hangouts_systemd_required_services_list %} | |||||
| Requires={{ service }} | |||||
| After={{ service }} | |||||
| {% endfor %} | |||||
| {% for service in matrix_mautrix_hangouts_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-mautrix-hangouts matrix-mautrix-hangouts-db 2>/dev/null' | |||||
| ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-mautrix-hangouts matrix-mautrix-hangouts-db 2>/dev/null' | |||||
| ExecStartPre={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-hangouts-db \ | |||||
| --log-driver=none \ | |||||
| --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ | |||||
| --cap-drop=ALL \ | |||||
| --network={{ matrix_docker_network }} \ | |||||
| -v {{ matrix_mautrix_hangouts_config_path }}:/config:z \ | |||||
| -v {{ matrix_mautrix_hangouts_data_path }}:/data:z \ | |||||
| {{ matrix_mautrix_hangouts_docker_image }} \ | |||||
| alembic -x config=/config/config.yaml upgrade head | |||||
| # Intentional delay, so that the homeserver (we likely depend on) can manage to start. | |||||
| ExecStartPre={{ matrix_host_command_sleep }} 5 | |||||
| ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-hangouts \ | |||||
| --log-driver=none \ | |||||
| --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ | |||||
| --cap-drop=ALL \ | |||||
| --network={{ matrix_docker_network }} \ | |||||
| {% if matrix_mautrix_hangouts_container_http_host_bind_port %} | |||||
| -p {{ matrix_mautrix_hangouts_container_http_host_bind_port }}:8080 \ | |||||
| {% endif %} | |||||
| -v {{ matrix_mautrix_hangouts_config_path }}:/config:z \ | |||||
| -v {{ matrix_mautrix_hangouts_data_path }}:/data:z \ | |||||
| {% for arg in matrix_mautrix_hangouts_container_extra_arguments %} | |||||
| {{ arg }} \ | |||||
| {% endfor %} | |||||
| {{ matrix_mautrix_hangouts_docker_image }} \ | |||||
| python3 -m mautrix_hangouts -c /config/config.yaml --no-update | |||||
| ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-mautrix-hangouts 2>/dev/null' | |||||
| ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-mautrix-hangouts 2>/dev/null' | |||||
| Restart=always | |||||
| RestartSec=30 | |||||
| SyslogIdentifier=matrix-mautrix-hangouts | |||||
| [Install] | |||||
| WantedBy=multi-user.target | |||||
| @@ -20,7 +20,6 @@ | |||||
| - matrix-bridge-appservice-irc | - matrix-bridge-appservice-irc | ||||
| - matrix-bridge-beeper-linkedin | - matrix-bridge-beeper-linkedin | ||||
| - matrix-bridge-mautrix-facebook | - matrix-bridge-mautrix-facebook | ||||
| - matrix-bridge-mautrix-hangouts | |||||
| - matrix-bridge-mautrix-googlechat | - matrix-bridge-mautrix-googlechat | ||||
| - matrix-bridge-mautrix-instagram | - matrix-bridge-mautrix-instagram | ||||
| - matrix-bridge-mautrix-signal | - matrix-bridge-mautrix-signal | ||||