mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-27 00:05:44 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
31
roles/matrix_element/defaults/main.yml
Normal file
31
roles/matrix_element/defaults/main.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
|
||||
# Only change several instances are deployed on the same server
|
||||
# in which case you must also set a different element_root_dir
|
||||
element_id: element
|
||||
|
||||
# Version to deploy, and expected sha1
|
||||
element_version: 1.9.5
|
||||
# sha1sum of the tar.gz
|
||||
element_archive_sha1: ca6f65fa29a78bcef905a2aef0616840be32b63f
|
||||
|
||||
# Where to install element
|
||||
element_root_dir: /opt/matrix/element
|
||||
|
||||
# Default servers
|
||||
# element_default_home_server: https://matrix.org
|
||||
element_default_identity_server: https://vector.im
|
||||
|
||||
# Should ansible manage upgrades or only initial install
|
||||
element_manage_upgrade: True
|
||||
|
||||
# Should a alilas be created, eg element to access it on /element
|
||||
# element_web_alias: element
|
||||
|
||||
# Optional list of allowed IP address. If undefined, everyone can access it
|
||||
# element_allowed_ip:
|
||||
# - 12.13.14.15
|
||||
# - 16.17.18.19
|
||||
|
||||
# Jitsi server to use
|
||||
# element_jitsi_server: jitsi.example.net
|
3
roles/matrix_element/handlers/main.yml
Normal file
3
roles/matrix_element/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- include: ../httpd_common/handlers/main.yml
|
||||
...
|
3
roles/matrix_element/meta/main.yml
Normal file
3
roles/matrix_element/meta/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: httpd_common
|
9
roles/matrix_element/tasks/archive_post.yml
Normal file
9
roles/matrix_element/tasks/archive_post.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/webapps_compress_archive.yml
|
||||
vars:
|
||||
- root_dir: "{{ element_root_dir }}"
|
||||
- version: "{{ element_current_version }}"
|
||||
when: element_install_mode == 'upgrade'
|
||||
tags: matrix
|
||||
|
7
roles/matrix_element/tasks/archive_pre.yml
Normal file
7
roles/matrix_element/tasks/archive_pre.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/webapps_archive.yml
|
||||
vars:
|
||||
- root_dir: "{{ element_root_dir }}"
|
||||
- version: "{{ element_current_version }}"
|
||||
tags: matrix
|
16
roles/matrix_element/tasks/cleanup.yml
Normal file
16
roles/matrix_element/tasks/cleanup.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
- name: Remove temp files
|
||||
file: path={{ element_root_dir }}/tmp/{{ item }} state=absent
|
||||
loop:
|
||||
- element-v{{ element_version }}.tar.gz
|
||||
- element-v{{ element_version }}
|
||||
tags: matrix
|
||||
|
||||
- name: Remove old Riot install
|
||||
file: path={{ item }} state=absent
|
||||
loop:
|
||||
- /opt/matrix/riot
|
||||
- /etc/httpd/ansible_conf.d/10-riot_riot.conf
|
||||
notify: reload httpd
|
||||
tags: matrix
|
15
roles/matrix_element/tasks/conf.yml
Normal file
15
roles/matrix_element/tasks/conf.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
- name: Remove sample config file
|
||||
file: path={{ element_root_dir }}/web/config.sample.json state=absent
|
||||
tags: matrix
|
||||
|
||||
- name: Deploy configuration
|
||||
template: src=config.json.j2 dest={{ element_root_dir }}/web/config.json
|
||||
tags: matrix
|
||||
|
||||
- name: Deploy httpd configuration
|
||||
template: src=httpd.conf.j2 dest=/etc/httpd/ansible_conf.d/10-element_{{ element_id }}.conf
|
||||
notify: reload httpd
|
||||
tags: matrix
|
||||
|
11
roles/matrix_element/tasks/directories.yml
Normal file
11
roles/matrix_element/tasks/directories.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
|
||||
- name: Create directory structure
|
||||
file: path={{ element_root_dir }}/{{ item.dir }} state=directory owner={{ item.owner | default(omit) }} group={{ item.group | default(omit) }} mode={{ item.mode | default(omit) }}
|
||||
with_items:
|
||||
- dir: tmp
|
||||
- dir: archives
|
||||
mode: 700
|
||||
- dir: meta
|
||||
mode: 700
|
||||
tags: matrix
|
12
roles/matrix_element/tasks/facts.yml
Normal file
12
roles/matrix_element/tasks/facts.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/webapps_set_install_mode.yml
|
||||
vars:
|
||||
- root_dir: "{{ element_root_dir }}"
|
||||
- version: "{{ element_version }}"
|
||||
tags: matrix
|
||||
- set_fact: element_install_mode={{ (install_mode == 'upgrade' and not element_manage_upgrade) | ternary('none',install_mode) }}
|
||||
tags: matrix
|
||||
- set_fact: element_current_version={{ current_version | default('') }}
|
||||
tags: matrix
|
||||
|
28
roles/matrix_element/tasks/install.yml
Normal file
28
roles/matrix_element/tasks/install.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
|
||||
- name: Download Riot
|
||||
get_url:
|
||||
url: "https://github.com/vector-im/element-web/releases/download/v{{ element_version }}/element-v{{ element_version }}.tar.gz"
|
||||
dest: "{{ element_root_dir }}/tmp/"
|
||||
checksum: "sha1:{{ element_archive_sha1 }}"
|
||||
when: element_install_mode != 'none'
|
||||
tags: matrix
|
||||
|
||||
- name: Extract element archive
|
||||
unarchive:
|
||||
src: "{{ element_root_dir }}/tmp/element-v{{ element_version }}.tar.gz"
|
||||
dest: "{{ element_root_dir }}/tmp/"
|
||||
remote_src: True
|
||||
when: element_install_mode != 'none'
|
||||
tags: matrix
|
||||
|
||||
- name: Move the content of element to the correct top directory
|
||||
synchronize:
|
||||
src: "{{ element_root_dir }}/tmp/element-v{{ element_version }}/"
|
||||
dest: "{{ element_root_dir }}/web/"
|
||||
recursive: True
|
||||
delete: True
|
||||
delegate_to: "{{ inventory_hostname }}"
|
||||
when: element_install_mode != 'none'
|
||||
tags: matrix
|
||||
|
13
roles/matrix_element/tasks/main.yml
Normal file
13
roles/matrix_element/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- include: facts.yml
|
||||
- include: directories.yml
|
||||
- include: archive_pre.yml
|
||||
when: element_install_mode == 'upgrade'
|
||||
- include: install.yml
|
||||
- include: conf.yml
|
||||
- include: archive_post.yml
|
||||
when: element_install_mode == 'upgrade'
|
||||
- include: write_version.yml
|
||||
- include: cleanup.yml
|
||||
|
7
roles/matrix_element/tasks/write_version.yml
Normal file
7
roles/matrix_element/tasks/write_version.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/webapps_post.yml
|
||||
vars:
|
||||
- root_dir: "{{ element_root_dir }}"
|
||||
- version: "{{ element_version }}"
|
||||
tags: matrix
|
39
roles/matrix_element/templates/config.json.j2
Normal file
39
roles/matrix_element/templates/config.json.j2
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"default_hs_url": "{{ element_default_home_server | default('https://' + synapse_server_name) | default('https://matrix.org') }}",
|
||||
"default_is_url": "{{ element_default_identity_server }}",
|
||||
"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.element.im/scalar/api"
|
||||
],
|
||||
"bug_report_endpoint_url": "https://element.im/bugreports/submit",
|
||||
"showLabsSettings": true,
|
||||
"roomDirectory": {
|
||||
"servers": [
|
||||
"matrix.org"
|
||||
]
|
||||
},
|
||||
"welcomeUserId": "@riot-bot:matrix.org",
|
||||
"piwik": {
|
||||
},
|
||||
{% if element_jitsi_server is defined %}
|
||||
"jitsi": {
|
||||
"preferredDomain": "{{ element_jitsi_server }}"
|
||||
},
|
||||
{% endif %}
|
||||
"settingDefaults": {
|
||||
"UIFeature.feedback": false,
|
||||
"UIFeature.thirdPartyId": false,
|
||||
{% if synapse_auth is defined and 'internal' not in synapse_auth and synapse_auth != 'internal' %}
|
||||
"UIFeature.passwordReset": false,
|
||||
"UIFeature.deactivate": false,
|
||||
{% endif %}
|
||||
"UIFeature.registration": {{ (synapse_enable_registration | default(False)) | ternary('true', 'false') }}
|
||||
},
|
||||
"happyJson": true
|
||||
}
|
14
roles/matrix_element/templates/httpd.conf.j2
Normal file
14
roles/matrix_element/templates/httpd.conf.j2
Normal file
@@ -0,0 +1,14 @@
|
||||
{% if element_web_alias is defined %}
|
||||
Alias /{{ element_web_alias }} {{ element_root_dir }}/web
|
||||
{% else %}
|
||||
# No alias defined, create a vhost to access it
|
||||
{% endif %}
|
||||
<Directory {{ element_root_dir }}/web>
|
||||
AllowOverride None
|
||||
Options None
|
||||
{% if element_allowed_ip is defined %}
|
||||
Require ip {{ element_allowed_ip | join(' ') }}
|
||||
{% else %}
|
||||
Require all granted
|
||||
{% endif %}
|
||||
</Directory>
|
5
roles/matrix_element/templates/perms.sh.j2
Normal file
5
roles/matrix_element/templates/perms.sh.j2
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
chown -R root:root {{ element_root_dir }}
|
||||
find {{ element_root_dir }}/web -type f -exec chmod 644 "{}" \;
|
||||
find {{ element_root_dir }}/web -type d -exec chmod 755 "{}" \;
|
Reference in New Issue
Block a user