parent
de0efe96e7
commit
c6ab1c6a90
@ -0,0 +1,41 @@
|
||||
# Configuring Element (optional)
|
||||
|
||||
By default, this playbook installs the [Element](https://github.com/vector-im/riot-web) Matrix client web application.
|
||||
If that's okay, you can skip this document.
|
||||
|
||||
|
||||
## Disabling Element
|
||||
|
||||
If you'd like for the playbook to not install (or to uninstall the previously installed Element), you can disable it in your configuration file (`inventory/host_vars/matrix.<your-domain>/vars.yml`):
|
||||
|
||||
```yaml
|
||||
matrix_client_element_enabled: false
|
||||
```
|
||||
|
||||
|
||||
## Configuring Element settings
|
||||
|
||||
The playbook provides some customization variables you could use to change Element's settings.
|
||||
|
||||
Their defaults are defined in [`roles/matrix-client-element/defaults/main.yml`](../roles/matrix-client-element/defaults/main.yml) and they ultimately end up in the generated `/matrix/element/config.json` file (on the server). This file is generated from the [`roles/matrix-client-element/templates/config.json.j2`](../roles/matrix-client-element/templates/config.json.j2) template.
|
||||
|
||||
**If there's an existing variable** which controls a setting you wish to change, you can simply define that variable in your configuration file (`inventory/host_vars/matrix.<your-domain>/vars.yml`) and [re-run the playbook](installing.md) to apply the changes.
|
||||
|
||||
Alternatively, **if there is no pre-defined variable** for an Element setting you wish to change:
|
||||
|
||||
- you can either **request a variable to be created** (or you can submit such a contribution yourself). Keep in mind that it's **probably not a good idea** to create variables for each one of Element's various settings that rarely get used.
|
||||
|
||||
- or, you can **extend and override the default configuration** ([`config.json.j2`](../roles/matrix-client-element/templates/config.json.j2)) by making use of the `matrix_client_element_configuration_extension_json_` variable. You can find information about this in [`roles/matrix-client-element/defaults/main.yml`](../roles/matrix-client-element/defaults/main.yml).
|
||||
|
||||
- or, if extending the configuration is still not powerful enough for your needs, you can **override the configuration completely** using `matrix_client_element_configuration_default` (or `matrix_client_element_configuration`). You can find information about this in [`roles/matrix-client-element/defaults/main.yml`](../roles/matrix-client-element/defaults/main.yml).
|
||||
|
||||
|
||||
## Themes
|
||||
|
||||
To change the look of Element, you can define your own themes manually by using the `matrix_client_element__settingDefaults_custom_themes` setting.
|
||||
|
||||
Or better yet, you can automatically pull it all themes provided by the [aaronraimist/element-themes](https://github.com/aaronraimist/element-themes) project by simply flipping a flag (`matrix_client_element_themes_enabled: true`).
|
||||
|
||||
If you make your own theme, we encourage you to submit it to the **aaronraimist/element-themes** project, so that the whole community could easily enjoy it.
|
||||
|
||||
Note that for a custom theme to work well, all Element instances that you use must have the same theme installed.
|
@ -1,40 +1,37 @@
|
||||
# Configuring Riot-web (optional)
|
||||
|
||||
By default, this playbook installs the [Riot-web](https://github.com/vector-im/riot-web) Matrix client web application.
|
||||
If that's okay, you can skip this document.
|
||||
By default, this playbook **used to install** the [Riot-web](https://github.com/vector-im/riot-web) Matrix client web application.
|
||||
|
||||
Riot has since been [renamed to Element](https://element.io/blog/welcome-to-element/).
|
||||
|
||||
## Disabling riot-web
|
||||
- to learn more about Element and its configuration, see our dedicated [Configuring Element](configuring-playbook-client-element.md) documentation page
|
||||
- to learn how to migrate from Riot to Element, see [Migrating to Element](#migrating-to-element) below
|
||||
|
||||
If you'd like for the playbook to not install (or to uninstall the previously installed riot-web), you can disable it in your configuration file (`inventory/host_vars/matrix.<your-domain>/vars.yml`):
|
||||
|
||||
```yaml
|
||||
matrix_riot_web_enabled: false
|
||||
```
|
||||
|
||||
## Configuring riot-web settings
|
||||
## Migrating to Element
|
||||
|
||||
The playbook provides some customization variables you could use to change riot-web's settings.
|
||||
### Migrating your custom settings
|
||||
|
||||
Their defaults are defined in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml) and they ultimately end up in the generated `/matrix/riot-web/config.json` file (on the server). This file is generated from the [`roles/matrix-riot-web/templates/config.json.j2`](../roles/matrix-riot-web/templates/config.json.j2) template.
|
||||
If you have custom `matrix_riot_web_` variables in your `inventory/host_vars/matrix.DOMAIN/vars.yml` file, you'll need to rename them (`matrix_riot_web_` -> `matrix_client_element_`).
|
||||
|
||||
**If there's an existing variable** which controls a setting you wish to change, you can simply define that variable in your configuration file (`inventory/host_vars/matrix.<your-domain>/vars.yml`) and [re-run the playbook](installing.md) to apply the changes.
|
||||
|
||||
Alternatively, **if there is no pre-defined variable** for a riot-web setting you wish to change:
|
||||
### Domain migration
|
||||
|
||||
- you can either **request a variable to be created** (or you can submit such a contribution yourself). Keep in mind that it's **probably not a good idea** to create variables for each one of riot-web's various settings that rarely get used.
|
||||
We used to set up Riot at the `riot.DOMAIN` domain. The playbook now sets up Element at `element.DOMAIN` by default.
|
||||
|
||||
- or, you can **extend and override the default configuration** ([`config.json.j2`](../roles/matrix-riot-web/templates/config.json.j2)) by making use of the `matrix_riot_web_configuration_extension_json_` variable. You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml).
|
||||
There are a few options for handling this:
|
||||
|
||||
- or, if extending the configuration is still not powerful enough for your needs, you can **override the configuration completely** using `matrix_riot_web_configuration_default` (or `matrix_riot_web_configuration`). You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml).
|
||||
- (**avoiding changes** - using the old `riot.DOMAIN` domain and avoiding DNS changes) -- to keep using `riot.DOMAIN` instead of `element.DOMAIN`, override the domain at which the playbook serves Element: `matrix_server_fqn_element: "riot.{{ matrix_domain }}"`
|
||||
|
||||
- (**embracing changes** - using only `element.DOMAIN`) - set up the `element.DOMAIN` DNS record (see [Configuring DNS](configuring-dns.md)). You can drop the `riot.DOMAIN` in this case. If so, you may also wish to remove old SSL certificates (`rm -rf /matrix/ssl/live/riot.DOMAIN`), so that `certbot` would stop trying to renew them.
|
||||
|
||||
## Themes
|
||||
- (**embracing changes and transitioning smoothly** - using both `element.DOMAIN` and `riot.DOMAIN`) - to serve Element at the new domain (`element.DOMAIN`) and to also have `riot.DOMAIN` redirect there - set up the `element.DOMAIN` DNS record (see [Configuring DNS](configuring-dns.md)) and enable Riot to Element redirection (`matrix_nginx_proxy_proxy_riot_compat_redirect_enabled: true`).
|
||||
|
||||
To change the look of riot-web, you can define your own themes manually by using the `matrix_riot_web_settingDefaults_custom_themes` setting.
|
||||
|
||||
Or better yet, you can automatically pull it all themes provided by the [aaronraimist/riot-web-themes](https://github.com/aaronraimist/riot-web-themes) project by simply flipping a flag (`matrix_riot_web_themes_enabled: true`).
|
||||
### Re-running the playbook
|
||||
|
||||
If you make your own theme, we encourage you to submit it to the **aaronraimist/riot-web-themes** project, so that the whole community could easily enjoy it.
|
||||
As always, after making the necessary DNS and configuration adjustments, re-run the playbook to apply the changes:
|
||||
|
||||
Note that for a custom theme to work well, all riot-web/riot-desktop instances that you use must have the same theme installed.
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
|
||||
```
|
||||
|
@ -0,0 +1,8 @@
|
||||
https://element.DOMAIN {
|
||||
# These might differ if you are supplying your own certificates
|
||||
tls /matrix/ssl/config/live/element.DOMAIN/fullchain.pem /matrix/ssl/config/live/element.DOMAIN/privkey.pem
|
||||
|
||||
proxy / http://127.0.0.1:8765 {
|
||||
transparent
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
https://riot.DOMAIN {
|
||||
# These might differ if you are supplying your own certificates
|
||||
tls /matrix/ssl/config/live/riot.DOMAIN/fullchain.pem /matrix/ssl/config/live/riot.DOMAIN/privkey.pem
|
||||
|
||||
proxy / http://127.0.0.1:8765 {
|
||||
transparent
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
matrix_client_element_enabled: true
|
||||
|
||||
matrix_client_element_container_image_self_build: false
|
||||
|
||||
matrix_client_element_docker_image: "vectorim/riot-web:v1.7.1"
|
||||
matrix_client_element_docker_image_force_pull: "{{ matrix_client_element_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_client_element_data_path: "{{ matrix_base_data_path }}/client-element"
|
||||
matrix_client_element_docker_src_files_path: "{{ matrix_client_element_data_path }}/docker-src"
|
||||
|
||||
# Controls whether the matrix-client-element container exposes its HTTP port (tcp/8080 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8765"), or empty string to not expose.
|
||||
matrix_client_element_container_http_host_bind_port: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_client_element_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-client-element.service depends on
|
||||
matrix_client_element_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# Element config.json customizations
|
||||
matrix_client_element_default_server_name: "{{ matrix_domain }}"
|
||||
matrix_client_element_default_hs_url: ""
|
||||
matrix_client_element_default_is_url: ~
|
||||
matrix_client_element_disable_custom_urls: true
|
||||
matrix_client_element_disable_guests: true
|
||||
matrix_client_element_integrations_ui_url: "https://scalar.vector.im/"
|
||||
matrix_client_element_integrations_rest_url: "https://scalar.vector.im/api"
|
||||
matrix_client_element_integrations_widgets_urls: ["https://scalar.vector.im/api"]
|
||||
matrix_client_element_integrations_jitsi_widget_url: "https://scalar.vector.im/api/widgets/jitsi.html"
|
||||
matrix_client_element_permalinkPrefix: "https://matrix.to"
|
||||
# Element public room directory server(s)
|
||||
matrix_client_element_roomdir_servers: ['matrix.org']
|
||||
matrix_client_element_welcome_user_id: "@riot-bot:matrix.org"
|
||||
# Branding of Element
|
||||
matrix_client_element_brand: "Element"
|
||||
|
||||
# URL to Logo on welcome page
|
||||
matrix_client_element_welcome_logo: "welcome/images/logo.svg"
|
||||
|
||||
# URL of link on welcome image
|
||||
matrix_client_element_welcome_logo_link: "https://element.io"
|
||||
|
||||
matrix_client_element_welcome_headline: "_t('Welcome to Element')"
|
||||
matrix_client_element_welcome_text: "_t('Decentralised, encrypted chat & collaboration powered by [matrix]')"
|
||||
|
||||
# Links, shown in footer of welcome page:
|
||||
# [{"text": "Link text", "url": "https://link.target"}, {"text": "Other link"}]
|
||||
matrix_client_element_branding_authFooterLinks: ~
|
||||
|
||||
# URL to image, shown during Login
|
||||
matrix_client_element_branding_authHeaderLogoUrl: "{{ matrix_client_element_welcome_logo }}"
|
||||
|
||||
# URL to Wallpaper, shown in background of welcome page
|
||||
matrix_client_element_branding_welcomeBackgroundUrl: ~
|
||||
|
||||
# By default, there's no Element homepage (when logged in). If you wish to have one,
|
||||
# point this to a `home.html` template file on your local filesystem.
|
||||
matrix_client_element_embedded_pages_home_path: ~
|
||||
|
||||
matrix_client_element_jitsi_preferredDomain: ''
|
||||
|
||||
# Controls whether the self-check feature should validate SSL certificates.
|
||||
matrix_client_element_self_check_validate_certificates: true
|
||||
|
||||
# don't show the registration button on welcome page
|
||||
matrix_client_element_registration_enabled: false
|
||||
|
||||
# Controls whether presence will be enabled
|
||||
matrix_client_element_enable_presence_by_hs_url: ~
|
||||
|
||||
# Controls whether custom Element themes will be installed.
|
||||
# When enabled, all themes found in the `matrix_client_element_themes_repository_url` repository
|
||||
# will be installed and enabled automatically.
|
||||
matrix_client_element_themes_enabled: false
|
||||
matrix_client_element_themes_repository_url: https://github.com/aaronraimist/element-themes
|
||||
|
||||
# Controls the default theme
|
||||
matrix_client_element_default_theme: 'light'
|
||||
|
||||
# Controls the `settingsDefault.custom_themes` setting of the Element configuration.
|
||||
# You can use this setting to define custom themes.
|
||||
#
|
||||
# Also, look at `matrix_client_element_themes_enabled` for a way to pull in a bunch of custom themes automatically.
|
||||
# If you define your own themes here and set `matrix_client_element_themes_enabled: true`, your themes will be preserved as well.
|
||||
#
|
||||
# Note that for a custom theme to work well, all Element instances that you use must have the same theme installed.
|
||||
matrix_client_element_settingDefaults_custom_themes: []
|
||||
|
||||
# Default Element 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_client_element_configuration_extension_json`)
|
||||
# or completely replace this variable with your own template.
|
||||
#
|
||||
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
|
||||
# This is unlike what it does when looking up YAML template files (no automatic parsing there).
|
||||
matrix_client_element_configuration_default: "{{ lookup('template', 'templates/config.json.j2') }}"
|
||||
|
||||
# Your custom JSON configuration for Element should go to `matrix_client_element_configuration_extension_json`.
|
||||
# This configuration extends the default starting configuration (`matrix_client_element_configuration_default`).
|
||||
#
|
||||
# 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_client_element_configuration_default`.
|
||||
#
|
||||
# Example configuration extension follows:
|
||||
#
|
||||
# matrix_client_element_configuration_extension_json: |
|
||||
# {
|
||||
# "disable_3pid_login": true,
|
||||
# "disable_login_language_selector": true
|
||||
# }
|
||||
matrix_client_element_configuration_extension_json: '{}'
|
||||
|
||||
matrix_client_element_configuration_extension: "{{ matrix_client_element_configuration_extension_json|from_json if matrix_client_element_configuration_extension_json|from_json is mapping else {} }}"
|
||||
|
||||
# Holds the final Element configuration (a combination of the default and its extension).
|
||||
# You most likely don't need to touch this variable. Instead, see `matrix_client_element_configuration_default`.
|
||||
matrix_client_element_configuration: "{{ matrix_client_element_configuration_default|combine(matrix_client_element_configuration_extension, recursive=True) }}"
|
@ -1,10 +1,10 @@
|
||||
- set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-riot-web'] }}"
|
||||
when: matrix_riot_web_enabled|bool
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-element'] }}"
|
||||
when: matrix_client_element_enabled|bool
|
||||
|
||||
# ansible lower than 2.8, does not support docker_image build parameters
|
||||
# for self buildig it is explicitly needed, so we rather fail here
|
||||
- name: Fail if running on Ansible lower than 2.8 and trying self building
|
||||
fail:
|
||||
msg: "To self build Riot Web image, you should usa ansible 2.8 or higher. E.g. pip contains such packages."
|
||||
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_riot_web_container_image_self_build"
|
||||
msg: "To self build the Element image, you should usa ansible 2.8 or higher. E.g. pip contains such packages."
|
||||
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_client_element_container_image_self_build"
|
@ -0,0 +1,34 @@
|
||||
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup|bool and matrix_client_element_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-client-element
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/prepare_themes.yml"
|
||||
when: run_setup|bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-client-element
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/migrate_riot_web.yml"
|
||||
when: run_setup|bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-client-element
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup.yml"
|
||||
when: run_setup|bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-client-element
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/self_check.yml"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "run_self_check|bool and matrix_client_element_enabled|bool"
|
||||
tags:
|
||||
- self-check
|
@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-riot-web.service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-riot-web.service"
|
||||
register: matrix_client_riot_web_service_stat
|
||||
when: "matrix_client_element_enabled|bool"
|
||||
|
||||
- name: Ensure matrix-riot-web is stopped
|
||||
service:
|
||||
name: matrix-riot-web
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-riot-web.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-riot-web.service"
|
||||
state: absent
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-riot-web.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Check existence of /matrix/riot-web
|
||||
stat:
|
||||
path: "/matrix/riot-web"
|
||||
register: matrix_client_riot_web_dir_stat
|
||||
when: "matrix_client_element_enabled|bool"
|
||||
|
||||
- name: Relocate /matrix/riot-web to /matrix/client-element
|
||||
command: "mv /matrix/riot-web /matrix/client-element"
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_riot_web_dir_stat.stat.exists"
|
@ -0,0 +1,48 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up Element themes
|
||||
#
|
||||
|
||||
- block:
|
||||
- name: Ensure Element themes repository is pulled
|
||||
git:
|
||||
repo: "{{ matrix_client_element_themes_repository_url }}"
|
||||
dest: "{{ role_path }}/files/scratchpad/themes"
|
||||
|
||||
- name: Find all Element theme files
|
||||
find:
|
||||
paths: "{{ role_path }}/files/scratchpad/themes"
|
||||
patterns: "*.json"
|
||||
recurse: true
|
||||
register: matrix_client_element_theme_file_list
|
||||
|
||||
- name: Read Element theme
|
||||
slurp:
|
||||
path: "{{ item.path }}"
|
||||
register: "matrix_client_element_theme_file_contents"
|
||||
with_items: "{{ matrix_client_element_theme_file_list.files }}"
|
||||
|
||||
- name: Load Element theme
|
||||
set_fact:
|
||||
matrix_client_element_settingDefaults_custom_themes: "{{ matrix_client_element_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}"
|
||||
with_items: "{{ matrix_client_element_theme_file_contents.results }}"
|
||||
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: matrix_client_element_themes_enabled|bool
|
||||
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of Element themes (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Ensure Element themes repository is removed
|
||||
file:
|
||||
path: "{{ role_path }}/files/scratchpad/themes"
|
||||
state: absent
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "not matrix_client_element_themes_enabled|bool"
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
matrix_client_element_url_endpoint_public: "https://{{ matrix_server_fqn_element }}/config.json"
|
||||
|
||||
- name: Check Element
|
||||
uri:
|
||||
url: "{{ matrix_client_element_url_endpoint_public }}"
|
||||
follow_redirects: none
|
||||
validate_certs: "{{ matrix_client_element_self_check_validate_certificates }}"
|
||||
register: matrix_client_element_self_check_result
|
||||
check_mode: no
|
||||
ignore_errors: true
|
||||
|
||||
- name: Fail if Element not working
|
||||
fail:
|
||||
msg: "Failed checking Element is up at `{{ matrix_server_fqn_element }}` (checked endpoint: `{{ matrix_client_element_url_endpoint_public }}`). Is Element running? Is port 443 open in your firewall? Full error: {{ matrix_client_element_self_check_result }}"
|
||||
when: "matrix_client_element_self_check_result.failed or 'json' not in matrix_client_element_self_check_result"
|
||||
|
||||
- name: Report working Element
|
||||
debug:
|
||||
msg: "Element at `{{ matrix_server_fqn_element }}` is working (checked endpoint: `{{ matrix_client_element_url_endpoint_public }}`)"
|
@ -0,0 +1,127 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up Element
|
||||
#
|
||||
|
||||
- name: Ensure Element paths exists
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_client_element_data_path }}", when: true }
|
||||
- { path: "{{ matrix_client_element_docker_src_files_path }}", when: "{{ matrix_client_element_container_image_self_build }}" }
|
||||
when: matrix_client_element_enabled|bool and item.when
|
||||
|
||||
- name: Ensure Element Docker image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_client_element_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_client_element_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_client_element_docker_image_force_pull }}"
|
||||
when: matrix_client_element_enabled|bool and not matrix_client_element_container_image_self_build
|
||||
|
||||
- name: Ensure Element repository is present on self-build
|
||||
git:
|
||||
repo: https://github.com/vector-im/riot-web.git
|
||||
dest: "{{ matrix_client_element_docker_src_files_path }}"
|
||||
version: "{{ matrix_client_element_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_element_container_image_self_build"
|
||||
|
||||
- name: Ensure Element Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_client_element_docker_image }}"
|
||||
source: build
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_client_element_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_element_container_image_self_build"
|
||||
|
||||
- name: Ensure Element configuration installed
|
||||
copy:
|
||||
content: "{{ matrix_client_element_configuration|to_nice_json }}"
|
||||
dest: "{{ matrix_client_element_data_path }}/config.json"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: matrix_client_element_enabled|bool
|
||||
|
||||
- name: Ensure Element config files installed
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ matrix_client_element_data_path }}/{{ item.name }}"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
|
||||
- {src: "{{ role_path }}/templates/welcome.html.j2", name: "welcome.html"}
|
||||
- {src: "{{ matrix_client_element_embedded_pages_home_path }}", name: "home.html"}
|
||||
when: "matrix_client_element_enabled|bool and item.src is not none"
|
||||
|
||||
- name: Ensure Element config files removed
|
||||
file:
|
||||
path: "{{ matrix_client_element_data_path }}/{{ item.name }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- {src: "{{ matrix_client_element_embedded_pages_home_path }}", name: "home.html"}
|
||||
when: "matrix_client_element_enabled|bool and item.src is none"
|
||||
|
||||
- name: Ensure matrix-client-element.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-client-element.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-client-element.service"
|
||||
mode: 0644
|
||||
register: matrix_client_element_systemd_service_result
|
||||
when: matrix_client_element_enabled|bool
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-client-element.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_client_element_enabled and matrix_client_element_systemd_service_result.changed"
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of Element (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-client-element.service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-client-element.service"
|
||||
register: matrix_client_element_service_stat
|
||||
when: "not matrix_client_element_enabled|bool"
|
||||
|
||||
- name: Ensure matrix-client-element is stopped
|
||||
service:
|
||||
name: matrix-client-element
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "not matrix_client_element_enabled|bool and matrix_client_element_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-client-element.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-client-element.service"
|
||||
state: absent
|
||||
when: "not matrix_client_element_enabled|bool and matrix_client_element_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-client-element.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "not matrix_client_element_enabled|bool and matrix_client_element_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Element paths doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_client_element_data_path }}"
|
||||
state: absent
|
||||
when: "not matrix_client_element_enabled|bool"
|
||||
|
||||
- name: Ensure Element Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_client_element_docker_image }}"
|
||||
state: absent
|
||||
when: "not matrix_client_element_enabled|bool"
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- name: Fail if required Element settings not defined
|
||||
fail:
|
||||
msg: >
|
||||
You need to define a required configuration setting (`{{ item }}`) for using Element.
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_client_element_default_hs_url"
|
||||
|
||||
- name: (Deprecation) Catch and report riot-web variables
|
||||
fail:
|
||||
msg: >-
|
||||
Riot has been renamed to Element (https://element.io/blog/welcome-to-element/).
|
||||
The playbook will migrate your existing configuration and data automatically, but you need to adjust variable names.
|
||||
Please change your configuration (vars.yml) to rename all riot-web variables (`{{ item.old }}` -> `{{ item.new }}`).
|
||||
Also note that DNS configuration changes may be necessary.
|
||||
when: "vars | dict2items | selectattr('key', 'match', item.old) | list | items2dict"
|
||||
with_items:
|
||||
- {'old': 'matrix_riot_web_.*', 'new': 'matrix_client_element_.*'}
|
@ -0,0 +1,45 @@
|
||||
{
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": {{ matrix_client_element_default_hs_url|string|to_json }},
|
||||
"server_name": {{ matrix_client_element_default_server_name|string|to_json }}
|
||||
},
|
||||
"m.identity_server": {
|
||||
"base_url": {{ matrix_client_element_default_is_url|string|to_json }}
|
||||
}
|
||||
},
|
||||
"settingDefaults": {
|
||||
"custom_themes": {{ matrix_client_element_settingDefaults_custom_themes|to_json }}
|
||||
},
|
||||
"default_theme": {{ matrix_client_element_default_theme|string|to_json }},
|
||||
"permalinkPrefix": {{ matrix_client_element_permalinkPrefix|string|to_json }},
|
||||
"disable_custom_urls": {{ matrix_client_element_disable_custom_urls|to_json }},
|
||||
"disable_guests": {{ matrix_client_element_disable_guests|to_json }},
|
||||
"brand": {{ matrix_client_element_brand|to_json }},
|
||||
"integrations_ui_url": {{ matrix_client_element_integrations_ui_url|string|to_json }},
|
||||
"integrations_rest_url": {{ matrix_client_element_integrations_rest_url|string|to_json }},
|
||||
"integrations_widgets_urls": {{ matrix_client_element_integrations_widgets_urls|to_json }},
|
||||
"integrations_jitsi_widget_url": {{ matrix_client_element_integrations_jitsi_widget_url|string|to_json }},
|
||||
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||
"enableLabs": true,
|
||||
"roomDirectory": {
|
||||
"servers": {{ matrix_client_element_roomdir_servers|to_json }}
|
||||
},
|
||||
"welcomeUserId": {{ matrix_client_element_welcome_user_id|to_json }},
|
||||
{% if matrix_client_element_enable_presence_by_hs_url is not none %}
|
||||
"enable_presence_by_hs_url": {{ matrix_client_element_enable_presence_by_hs_url|to_json }},
|
||||
{% endif %}
|
||||
"embeddedPages": {
|
||||
"homeUrl": {{ matrix_client_element_embedded_pages_home_url|string|to_json }}
|
||||
},
|
||||
{% if matrix_client_element_jitsi_preferredDomain %}
|
||||
"jitsi": {
|
||||
"preferredDomain": {{ matrix_client_element_jitsi_preferredDomain|to_json }}
|
||||
},
|
||||
{% endif %}
|
||||
"branding": {
|
||||
"authFooterLinks": {{ matrix_client_element_branding_authFooterLinks|to_json }},
|
||||
"authHeaderLogoUrl": {{ matrix_client_element_branding_authHeaderLogoUrl|to_json }},
|
||||
"welcomeBackgroundUrl": {{ matrix_client_element_branding_welcomeBackgroundUrl|to_json }}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Element server
|
||||
{% for service in matrix_client_element_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} kill matrix-client-element
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} rm matrix-client-element
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-client-element \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_client_element_container_http_host_bind_port %}
|
||||
-p {{ matrix_client_element_container_http_host_bind_port }}:8080 \
|
||||
{% endif %}
|
||||
--tmpfs=/tmp:rw,noexec,nosuid,size=10m \
|
||||
-v {{ matrix_client_element_data_path }}/nginx.conf:/etc/nginx/nginx.conf:ro \
|
||||
-v {{ matrix_client_element_data_path }}/config.json:/app/config.json:ro \
|
||||
-v {{ matrix_client_element_data_path }}/config.json:/app/config.{{ matrix_server_fqn_element }}.json:ro \
|
||||
{% if matrix_client_element_embedded_pages_home_path is not none %}
|
||||
-v {{ matrix_client_element_data_path }}/home.html:/app/home.html:ro \
|
||||
{% endif %}
|
||||
-v {{ matrix_client_element_data_path }}/welcome.html:/app/welcome.html:ro \
|
||||
{% for arg in matrix_client_element_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_client_element_docker_image }}
|
||||
|
||||
ExecStop=-{{ matrix_host_command_docker }} kill matrix-client-element
|
||||
ExecStop=-{{ matrix_host_command_docker }} rm matrix-client-element
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-client-element
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
matrix_client_element_embedded_pages_home_url: "{{ ('' if matrix_client_element_embedded_pages_home_path is none else 'home.html') }}"
|
@ -0,0 +1,73 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
|
||||
{% macro render_vhost_directives() %}
|
||||
gzip on;
|
||||
gzip_types text/plain application/json application/javascript text/css image/x-icon font/ttf image/gif;
|
||||
{% for configuration_block in matrix_nginx_proxy_proxy_element_additional_server_configuration_blocks %}
|
||||
{{- configuration_block }}
|
||||
{% endfor %}
|
||||
|
||||
location / {
|
||||
{% if matrix_nginx_proxy_enabled %}
|
||||
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||
resolver 127.0.0.11 valid=5s;
|
||||
set $backend "matrix-client-element:8080";
|
||||
proxy_pass http://$backend;
|
||||
{% else %}
|
||||
{# Generic configuration for use outside of our container setup #}
|
||||
proxy_pass http://127.0.0.1:8765;
|
||||
{% endif %}
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
}
|
||||
{% endmacro %}
|
||||
|
||||
server {
|
||||
listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
|
||||
|
||||
server_name {{ matrix_nginx_proxy_proxy_element_hostname }};
|
||||
|
||||
server_tokens off;
|
||||
root /dev/null;
|
||||
|
||||
{% if matrix_nginx_proxy_https_enabled %}
|
||||
location /.well-known/acme-challenge {
|
||||
{% if matrix_nginx_proxy_enabled %}
|
||||
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||
resolver 127.0.0.11 valid=5s;
|
||||
set $backend "matrix-certbot:8080";
|
||||
proxy_pass http://$backend;
|
||||
{% else %}
|
||||
{# Generic configuration for use outside of our container setup #}
|
||||
proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$http_host$request_uri;
|
||||
}
|
||||
{% else %}
|
||||
{{ render_vhost_directives() }}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% if matrix_nginx_proxy_https_enabled %}
|
||||
server {
|
||||
listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
|
||||
listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
|
||||
|
||||
server_name {{ matrix_nginx_proxy_proxy_element_hostname }};
|
||||
|
||||
server_tokens off;
|
||||
root /dev/null;
|
||||
|
||||
ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/fullchain.pem;
|
||||
ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/privkey.pem;
|
||||
ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
|
||||
|
||||
{{ render_vhost_directives() }}
|
||||
}
|
||||
{% endif %}
|
@ -1,122 +0,0 @@
|
||||
matrix_riot_web_enabled: true
|
||||
|
||||
matrix_riot_web_container_image_self_build: false
|
||||
|
||||
matrix_riot_web_docker_image: "vectorim/riot-web:v1.7.1"
|
||||
matrix_riot_web_docker_image_force_pull: "{{ matrix_riot_web_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_riot_web_data_path: "{{ matrix_base_data_path }}/riot-web"
|
||||
matrix_riot_web_docker_src_files_path: "{{ matrix_riot_web_data_path }}/docker-src"
|
||||
|
||||
# Controls whether the matrix-riot-web container exposes its HTTP port (tcp/8080 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8765"), or empty string to not expose.
|
||||
matrix_riot_web_container_http_host_bind_port: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_riot_web_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-riot-web.service depends on
|
||||
matrix_riot_web_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# Riot config.json customizations
|
||||
matrix_riot_web_default_server_name: "{{ matrix_domain }}"
|
||||
matrix_riot_web_default_hs_url: ""
|
||||
matrix_riot_web_default_is_url: ~
|
||||
matrix_riot_web_disable_custom_urls: true
|
||||
matrix_riot_web_disable_guests: true
|
||||
matrix_riot_web_integrations_ui_url: "https://scalar.vector.im/"
|
||||
matrix_riot_web_integrations_rest_url: "https://scalar.vector.im/api"
|
||||
matrix_riot_web_integrations_widgets_urls: ["https://scalar.vector.im/api"]
|
||||
matrix_riot_web_integrations_jitsi_widget_url: "https://scalar.vector.im/api/widgets/jitsi.html"
|
||||
matrix_riot_web_permalinkPrefix: "https://matrix.to"
|
||||
# Riot public room directory server(s)
|
||||
matrix_riot_web_roomdir_servers: ['matrix.org']
|
||||
matrix_riot_web_welcome_user_id: "@riot-bot:matrix.org"
|
||||
# Branding of riot web
|
||||
matrix_riot_web_brand: "Riot"
|
||||
|
||||
# URL to Logo on welcome page
|
||||
matrix_riot_web_welcome_logo: "welcome/images/logo.svg"
|
||||
|
||||
# URL of link on welcome image
|
||||
matrix_riot_web_welcome_logo_link: "https://element.io"
|
||||
|
||||
matrix_riot_web_welcome_headline: "_t('Welcome to Element')"
|
||||
matrix_riot_web_welcome_text: "_t('Decentralised, encrypted chat & collaboration powered by [matrix]')"
|
||||
|
||||
# Links, shown in footer of welcome page:
|
||||
# [{"text": "Link text", "url": "https://link.target"}, {"text": "Other link"}]
|
||||
matrix_riot_web_branding_authFooterLinks: ~
|
||||
|
||||
# URL to image, shown during Login
|
||||
matrix_riot_web_branding_authHeaderLogoUrl: "{{ matrix_riot_web_welcome_logo }}"
|
||||
|
||||
# URL to Wallpaper, shown in background of welcome page
|
||||
matrix_riot_web_branding_welcomeBackgroundUrl: ~
|
||||
|
||||
# By default, there's no Riot homepage (when logged in). If you wish to have one,
|
||||
# point this to a `home.html` template file on your local filesystem.
|
||||
matrix_riot_web_embedded_pages_home_path: ~
|
||||
|
||||
matrix_riot_web_jitsi_preferredDomain: ''
|
||||
|
||||
# Controls whether the self-check feature should validate SSL certificates.
|
||||
matrix_riot_web_self_check_validate_certificates: true
|
||||
|
||||
# don't show the registration button on welcome page
|
||||
matrix_riot_web_registration_enabled: false
|
||||
|
||||
# Controls whether Riot shows the presence features
|
||||
matrix_riot_web_enable_presence_by_hs_url: ~
|
||||
|
||||
# Controls whether custom riot-web themes will be installed.
|
||||
# When enabled, all themes found in the `matrix_riot_web_themes_repository_url` repository
|
||||
# will be installed and enabled automatically.
|
||||
matrix_riot_web_themes_enabled: false
|
||||
matrix_riot_web_themes_repository_url: https://github.com/aaronraimist/riot-web-themes
|
||||
|
||||
# Controls the default riot-web theme
|
||||
matrix_riot_web_default_theme: 'light'
|
||||
|
||||
# Controls the `settingsDefault.custom_themes` setting of the riot-web configuration.
|
||||
# You can use this setting to define custom themes.
|
||||
#
|
||||
# Also, look at `matrix_riot_web_themes_enabled` for a way to pull in a bunch of custom themes automatically.
|
||||
# If you define your own themes here and set `matrix_riot_web_themes_enabled: true`, your themes will be preserved as well.
|
||||
#
|
||||
# Note that for a custom theme to work well, all riot-web/riot-desktop instances that you use must have the same theme installed.
|
||||
matrix_riot_web_settingDefaults_custom_themes: []
|
||||
|
||||
# Default riot-web 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_riot_web_configuration_extension_json`)
|
||||
# or completely replace this variable with your own template.
|
||||
#
|
||||
# The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict.
|
||||
# This is unlike what it does when looking up YAML template files (no automatic parsing there).
|
||||
matrix_riot_web_configuration_default: "{{ lookup('template', 'templates/config.json.j2') }}"
|
||||
|
||||
# Your custom JSON configuration for riot-web should go to `matrix_riot_web_configuration_extension_json`.
|
||||
# This configuration extends the default starting configuration (`matrix_riot_web_configuration_default`).
|
||||
#
|
||||
# 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_riot_web_configuration_default`.
|
||||
#
|
||||
# Example configuration extension follows:
|
||||
#
|
||||
# matrix_riot_web_configuration_extension_json: |
|
||||
# {
|
||||
# "disable_3pid_login": true,
|
||||
# "disable_login_language_selector": true
|
||||
# }
|
||||
matrix_riot_web_configuration_extension_json: '{}'
|
||||
|
||||
matrix_riot_web_configuration_extension: "{{ matrix_riot_web_configuration_extension_json|from_json if matrix_riot_web_configuration_extension_json|from_json is mapping else {} }}"
|
||||
|
||||
# Holds the final riot-web configuration (a combination of the default and its extension).
|
||||
# You most likely don't need to touch this variable. Instead, see `matrix_riot_web_configuration_default`.
|
||||
matrix_riot_web_configuration: "{{ matrix_riot_web_configuration_default|combine(matrix_riot_web_configuration_extension, recursive=True) }}"
|
@ -1,28 +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_riot_web_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-riot-web
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/prepare_riot_web_themes.yml"
|
||||
when: run_setup|bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-riot-web
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_riot_web.yml"
|
||||
when: run_setup|bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-riot-web
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/self_check_riot_web.yml"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "run_self_check|bool and matrix_riot_web_enabled|bool"
|
||||
tags:
|
||||
- self-check
|
@ -1,48 +0,0 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up riot-web themes
|
||||
#
|
||||
|
||||
- block:
|
||||
- name: Ensure riot-web themes repository is pulled
|
||||
git:
|
||||
repo: "{{ matrix_riot_web_themes_repository_url }}"
|
||||
dest: "{{ role_path }}/files/scratchpad/riot-web-themes"
|
||||
|
||||
- name: Find all riot-web theme files
|
||||
find:
|
||||
paths: "{{ role_path }}/files/scratchpad/riot-web-themes"
|
||||
patterns: "*.json"
|
||||
recurse: true
|
||||
register: matrix_riot_web_theme_file_list
|
||||
|
||||
- name: Read riot-web theme
|
||||
slurp:
|
||||
path: "{{ item.path }}"
|
||||
register: "matrix_riot_web_theme_file_contents"
|
||||
with_items: "{{ matrix_riot_web_theme_file_list.files }}"
|
||||
|
||||
- name: Load riot-web theme
|
||||
set_fact:
|
||||
matrix_riot_web_settingDefaults_custom_themes: "{{ matrix_riot_web_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}"
|
||||
with_items: "{{ matrix_riot_web_theme_file_contents.results }}"
|
||||
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: matrix_riot_web_themes_enabled|bool
|
||||
|
||||
|
||||
# #
|
||||
# # Tasks related to getting rid of riot-web themes (if it was previously enabled)
|
||||
# #
|
||||
|
||||
- name: Ensure riot-web themes repository is removed
|
||||
file:
|
||||
path: "{{ role_path }}/files/scratchpad/riot-web-themes"
|
||||
state: absent
|
||||
run_once: true
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "not matrix_riot_web_themes_enabled|bool"
|
@ -1,22 +0,0 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
riot_web_url_endpoint_public: "https://{{ matrix_server_fqn_riot }}/config.json"
|
||||
|
||||
- name: Check riot-web
|
||||
uri:
|
||||
url: "{{ riot_web_url_endpoint_public }}"
|
||||
follow_redirects: none
|
||||
validate_certs: "{{ matrix_riot_web_self_check_validate_certificates }}"
|
||||
register: result_riot_web
|
||||
check_mode: no
|
||||
ignore_errors: true
|
||||
|
||||
- name: Fail if riot-web not working
|
||||
fail:
|
||||
msg: "Failed checking riot-web is up at `{{ matrix_server_fqn_riot }}` (checked endpoint: `{{ riot_web_url_endpoint_public }}`). Is Riot running? Is port 443 open in your firewall? Full error: {{ result_riot_web }}"
|
||||
when: "result_riot_web.failed or 'json' not in result_riot_web"
|
||||
|
||||
- name: Report working riot-web
|
||||
debug:
|
||||
msg: "riot-web at `{{ matrix_server_fqn_riot }}` is working (checked endpoint: `{{ riot_web_url_endpoint_public }}`)"
|
@ -1,127 +0,0 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up riot-web
|
||||
#
|
||||
|
||||
- name: Ensure Matrix riot-web path exists
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_riot_web_data_path }}", when: true }
|
||||
- { path: "{{ matrix_riot_web_docker_src_files_path }}", when: "{{ matrix_riot_web_container_image_self_build }}" }
|
||||
when: matrix_riot_web_enabled|bool and item.when
|
||||
|
||||
- name: Ensure riot-web Docker image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_riot_web_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_riot_web_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_riot_web_docker_image_force_pull }}"
|
||||
when: matrix_riot_web_enabled|bool and not matrix_riot_web_container_image_self_build
|
||||
|
||||
- name: Ensure Riot Web repository is present on self-build
|
||||
git:
|
||||
repo: https://github.com/vector-im/riot-web.git
|
||||
dest: "{{ matrix_riot_web_docker_src_files_path }}"
|
||||
version: "{{ matrix_riot_web_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
when: "matrix_riot_web_enabled|bool and matrix_riot_web_container_image_self_build"
|
||||
|
||||
- name: Ensure Riot Web Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_riot_web_docker_image }}"
|
||||
source: build
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_riot_web_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_riot_web_enabled|bool and matrix_riot_web_container_image_self_build"
|
||||
|
||||
- name: Ensure Matrix riot-web configuration installed
|
||||
copy:
|
||||
content: "{{ matrix_riot_web_configuration|to_nice_json }}"
|
||||
dest: "{{ matrix_riot_web_data_path }}/config.json"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: matrix_riot_web_enabled|bool
|
||||
|
||||
- name: Ensure Matrix riot-web config files installed
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ matrix_riot_web_data_path }}/{{ item.name }}"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
|
||||
- {src: "{{ role_path }}/templates/welcome.html.j2", name: "welcome.html"}
|
||||
- {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"}
|
||||
when: "matrix_riot_web_enabled|bool and item.src is not none"
|
||||
|
||||
- name: Ensure Matrix riot-web config files removed
|
||||
file:
|
||||
path: "{{ matrix_riot_web_data_path }}/{{ item.name }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"}
|
||||
when: "matrix_riot_web_enabled|bool and item.src is none"
|
||||
|
||||
- name: Ensure matrix-riot-web.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-riot-web.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-riot-web.service"
|
||||
mode: 0644
|
||||
register: matrix_riot_web_systemd_service_result
|
||||
when: matrix_riot_web_enabled|bool
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-riot-web.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_riot_web_enabled and matrix_riot_web_systemd_service_result.changed"
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of riot-web (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-riot-web service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-riot-web.service"
|
||||
register: matrix_riot_web_service_stat
|
||||
when: "not matrix_riot_web_enabled|bool"
|
||||
|
||||
- name: Ensure matrix-riot-web is stopped
|
||||
service:
|
||||
name: matrix-riot-web
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-riot-web.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-riot-web.service"
|
||||
state: absent
|
||||
when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-riot-web.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Matrix riot-web paths doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_riot_web_data_path }}"
|
||||
state: absent
|
||||
when: "not matrix_riot_web_enabled|bool"
|
||||
|
||||
- name: Ensure riot-web Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_riot_web_docker_image }}"
|
||||
state: absent
|
||||
when: "not matrix_riot_web_enabled|bool"
|
@ -1,23 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Fail if required riot-web settings not defined
|
||||
fail:
|
||||
msg: >
|
||||
You need to define a required configuration setting (`{{ item }}`) for using riot-web.
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_riot_web_default_hs_url"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed riot-web variables
|
||||
fail:
|
||||
msg: >-
|
||||
Your configuration contains a variable, which now has a different name.
|
||||
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
|
||||
when: "item.old in vars"
|
||||
with_items:
|
||||
- {'old': 'matrix_riot_web_homepage_template', 'new': 'matrix_riot_web_embedded_pages_home_path'}
|
||||
- {'old': 'matrix_riot_web_homepage_template_general', 'new': '<removed>'}
|
||||
- {'old': 'matrix_riot_web_homepage_template_technical', 'new': '<removed>'}
|
||||
- {'old': 'matrix_riot_web_homepage_template_building', 'new': '<removed>'}
|
||||
- {'old': 'matrix_riot_web_homepage_template_contributing', 'new': '<removed>'}
|
||||
- {'old': 'matrix_riot_web_container_expose_port', 'new': '<superseded by matrix_riot_web_container_http_host_bind_port>'}
|
@ -1,45 +0,0 @@
|
||||
{
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": {{ matrix_riot_web_default_hs_url|string|to_json }},
|
||||
"server_name": {{ matrix_riot_web_default_server_name|string|to_json }}
|
||||
},
|
||||
"m.identity_server": {
|
||||
"base_url": {{ matrix_riot_web_default_is_url|string|to_json }}
|
||||
}
|
||||
},
|
||||
"settingDefaults": {
|
||||
"custom_themes": {{ matrix_riot_web_settingDefaults_custom_themes|to_json }}
|
||||
},
|
||||
"default_theme": {{ matrix_riot_web_default_theme|string|to_json }},
|
||||
"permalinkPrefix": {{ matrix_riot_web_permalinkPrefix|string|to_json }},
|
||||
"disable_custom_urls": {{ matrix_riot_web_disable_custom_urls|to_json }},
|
||||
"disable_guests": {{ matrix_riot_web_disable_guests|to_json }},
|
||||
"brand": {{ matrix_riot_web_brand|to_json }},
|
||||
"integrations_ui_url": {{ matrix_riot_web_integrations_ui_url|string|to_json }},
|
||||
"integrations_rest_url": {{ matrix_riot_web_integrations_rest_url|string|to_json }},
|
||||
"integrations_widgets_urls": {{ matrix_riot_web_integrations_widgets_urls|to_json }},
|
||||
"integrations_jitsi_widget_url": {{ matrix_riot_web_integrations_jitsi_widget_url|string|to_json }},
|
||||
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||
"enableLabs": true,
|
||||
"roomDirectory": {
|
||||
"servers": {{ matrix_riot_web_roomdir_servers|to_json }}
|
||||
},
|
||||
"welcomeUserId": {{ matrix_riot_web_welcome_user_id|to_json }},
|
||||
{% if matrix_riot_web_enable_presence_by_hs_url is not none %}
|
||||
"enable_presence_by_hs_url": {{ matrix_riot_web_enable_presence_by_hs_url|to_json }},
|
||||
{% endif %}
|
||||
"embeddedPages": {
|
||||
"homeUrl": {{ matrix_riot_web_embedded_pages_home_url|string|to_json }}
|
||||
},
|
||||
{% if matrix_riot_web_jitsi_preferredDomain %}
|
||||
"jitsi": {
|
||||
"preferredDomain": {{ matrix_riot_web_jitsi_preferredDomain|to_json }}
|
||||
},
|
||||
{% endif %}
|
||||
"branding": {
|
||||
"authFooterLinks": {{ matrix_riot_web_branding_authFooterLinks|to_json }},
|
||||
"authHeaderLogoUrl": {{ matrix_riot_web_branding_authHeaderLogoUrl|to_json }},
|
||||
"welcomeBackgroundUrl": {{ matrix_riot_web_branding_welcomeBackgroundUrl|to_json }}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix riot-web server
|
||||
{% for service in matrix_riot_web_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} kill matrix-riot-web
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} rm matrix-riot-web
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-riot-web \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_riot_web_container_http_host_bind_port %}
|
||||
-p {{ matrix_riot_web_container_http_host_bind_port }}:8080 \
|
||||
{% endif %}
|
||||
--tmpfs=/tmp:rw,noexec,nosuid,size=10m \
|
||||
-v {{ matrix_riot_web_data_path }}/nginx.conf:/etc/nginx/nginx.conf:ro \
|
||||
-v {{ matrix_riot_web_data_path }}/config.json:/app/config.json:ro \
|
||||
-v {{ matrix_riot_web_data_path }}/config.json:/app/config.{{ matrix_server_fqn_riot }}.json:ro \
|
||||
{% if matrix_riot_web_embedded_pages_home_path is not none %}
|
||||
-v {{ matrix_riot_web_data_path }}/home.html:/app/home.html:ro \
|
||||
{% endif %}
|
||||
-v {{ matrix_riot_web_data_path }}/welcome.html:/app/welcome.html:ro \
|
||||
{% for arg in matrix_riot_web_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_riot_web_docker_image }}
|
||||
|
||||
ExecStop=-{{ matrix_host_command_docker }} kill matrix-riot-web
|
||||
ExecStop=-{{ matrix_host_command_docker }} rm matrix-riot-web
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-riot-web
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,3 +0,0 @@
|
||||
---
|
||||
|
||||
matrix_riot_web_embedded_pages_home_url: "{{ ('' if matrix_riot_web_embedded_pages_home_path is none else 'home.html') }}"
|
Loading…
Reference in new issue