This commit is contained in:
Uumas
2021-10-05 21:39:42 +03:00
parent 73c5bf51a8
commit 7e76a7f79a
8 changed files with 149 additions and 1 deletions

19
docs/element.md Normal file
View File

@@ -0,0 +1,19 @@
# Required variables
These variables are required. Example values included. Some general variables might also be required for this role.
```
ports:
element_http: 8080
matrix_domain: domain.tld
matrix_server_domain: matrix.domain.tld
```
These variables are optional and have the following default values:
```
matrix_external_url: https://{{ matrix_server_domain }}
reverse_proxy_type: caddy
jitsi_domain: jitsi.riot.im
```

View File

@@ -2,7 +2,7 @@
namespace: uumas namespace: uumas
name: docker name: docker
version: 0.1.1 version: 0.1.5
readme: README.md readme: README.md
repository: https://git.uumas.fi/uumas/ansible-docker repository: https://git.uumas.fi/uumas/ansible-docker
license_file: LICENSE license_file: LICENSE

1
roles/element/README.md Normal file
View File

@@ -0,0 +1 @@
Installs element in docker

View File

@@ -0,0 +1,4 @@
---
reverse_proxy_type: caddy

View File

@@ -0,0 +1,7 @@
---
dependencies:
- docker
- role: uumas.general.caddy
when: reverse_proxy_type == 'caddy'

View File

@@ -0,0 +1,39 @@
---
- name: Element web
docker_container:
name: 'element'
image: 'vectorim/element-web:latest'
pull: yes
container_default_behavior: no_defaults
volumes:
- /app
published_ports:
- "127.0.0.1:{{ ports.element_http }}:80"
restart_policy: always
register: element_out
- set_fact:
element_config_volume: "{{ element_out.container.Mounts | selectattr('Destination', 'equalto', '/app') | join }}"
- name: Read element config to variable
include_vars:
file: element_config.yml
name: element_config
- name: Put element config in place
copy:
content: "{{ element_config }}"
dest: "{{ element_config_volume.Source }}/config.json"
- name: Add caddy reverse proxy config
blockinfile:
path: /etc/caddy/Caddyfile
marker: "# {mark} ANSIBLE MANAGED BLOCK element"
block: |
element.{{ domain }} chat.{{ domain }} {
reverse_proxy http://127.0.0.1:{{ ports.element_http }}
}
validate: 'caddy validate --config %s --adapter caddyfile'
backup: yes
notify: reload caddy
when: reverse_proxy_type == 'caddy'

View File

@@ -0,0 +1,44 @@
{
"default_server_config": {
"m.homeserver": {
"base_url": "{{ matrix_external_url }}",
"server_name": "{{ matrix_domain }}"
}
},
"disable_custom_urls": true,
"disable_guests": true,
"disable_login_language_selector": false,
"disable_3pid_login": true,
"brand": "Element",
"integrations_ui_url": "https://scalar.vector.im/",
"integrations_rest_url": "https://scalar.vector.im/api",
"integrations_widgets_urls": [
"https://scalar.vector.im/_matrix/integrations/v1",
"https://scalar.vector.im/api",
"https://scalar-staging.vector.im/_matrix/integrations/v1",
"https://scalar-staging.vector.im/api",
"https://scalar-staging.riot.im/scalar/api"
],
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
"defaultCountryCode": "GB",
"showLabsSettings": false,
"default_federate": true,
"default_theme": "dark",
"roomDirectory": {
"servers": [
"{{ matrix_domain }}"
]
},
"enable_presence_by_hs_url": {
"https://matrix.org": false,
"https://matrix-client.matrix.org": false
},
"settingDefaults": {
"breadcrumbs": true
},
{% if jitsi_domain is defined %}
"jitsi": {
"preferredDomain": "{{ jitsi_domain }}"
}
{% endif %}
}

View File

@@ -0,0 +1,34 @@
---
default_server_config:
m.homeserver:
base_url: "{{ matrix_external_url }}"
server_name: "{{ matrix_domain }}"
disable_custom_urls: yes
disable_guests: yes
disable_login_language_selector: false
disable_3pid_login: true
brand: Element
integrations_ui_url: https://scalar.vector.im/
integrations_rest_url: https://scalar.vector.im/api
integrations_widgets_urls:
- https://scalar.vector.im/_matrix/integrations/v1
- https://scalar.vector.im/api
- https://scalar-staging.vector.im/_matrix/integrations/v1
- https://scalar-staging.vector.im/api
- https://scalar-staging.riot.im/scalar/api
bug_report_endpoint_url: https://element.io/bugreports/submit
defaultCountryCode: GB
showLabsSettings: no
default_federate: yes
default_theme: dark
roomDirectory:
servers:
- "{{ matrix_domain }}"
enable_presence_by_hs_url:
"https://matrix.org": no
"https://matrix-client.matrix.org": no
settingDefaults:
breadcrumbs: yes
jitsi:
preferredDomain: "{{ jitsi_domain | default('jitsi.riot.im') }}"