ansible-debops-infrastructure

DebOps and Ansible scripts to manage my infrastructure
git clone git://git.erethon.com/ansible-debops-infrastructure
Log | Files | Refs

commit 885fce6746744804246158a2fc5bad27ef33dbe2
parent 859a6bcc719f6c2fd1730b7adc2c223df01c3049
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Sat, 12 Sep 2020 22:58:03 +0300

ansible: Rename Riot role to Element, add playbook

Diffstat:
ansible/playbooks/element.yml | 12++++++++++++
ansible/roles/element/defaults/main.yml | 23+++++++++++++++++++++++
ansible/roles/element/tasks/main.yml | 37+++++++++++++++++++++++++++++++++++++
ansible/roles/element/templates/config.json | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
ansible/roles/riot/defaults/main.yml | 23-----------------------
ansible/roles/riot/tasks/main.yml | 37-------------------------------------
ansible/roles/riot/templates/config.json | 55-------------------------------------------------------
7 files changed, 127 insertions(+), 115 deletions(-)

diff --git a/ansible/playbooks/element.yml b/ansible/playbooks/element.yml @@ -0,0 +1,12 @@ +--- +- hosts: element + become: True + + environment: '{{ inventory__environment | d({}) + | combine(inventory__group_environment | d({})) + | combine(inventory__host_environment | d({})) }}' + + roles: + + - role: debops.secret + - role: riot diff --git a/ansible/roles/element/defaults/main.yml b/ansible/roles/element/defaults/main.yml @@ -0,0 +1,23 @@ +--- + +riot__signing_key: https://packages.riot.im/riot-release-key.asc + +riot__release_version: "1.7.5" + +riot__release_checksum: "96c67933f6a32d06bc3f0111660c6f80500a8397e53bbe37c8906f79e76cb18085911d32b55550222891d95340772816802b830f5d81a5d7c7205024a69934eb" + +riot__release_url: "https://github.com/vector-im/element-web/releases/download/v{{ riot__release_version }}/riot-v{{ riot__release_version }}.tar.gz" + +riot__release_signature_url: "https://github.com/vector-im/element-web/releases/download/v{{ riot__release_version }}/riot-v{{ riot__release_version }}.tar.gz.asc" + +riot__deploy_directory: "" + +riot__matrix_homeserver: "https://matrix.org" + +riot__matrix_server_name: "matrix.org" + +riot__matrix_identity_server: "https://vector.im" + +riot__brand: "Riot" + +riot__jitsi_url: "jitsi.modular.im" diff --git a/ansible/roles/element/tasks/main.yml b/ansible/roles/element/tasks/main.yml @@ -0,0 +1,36 @@ +--- + +- name: Download Riot GPG key + get_url: + url: "{{ riot__signing_key }}" + dest: /tmp/riot-release-key.asc + +- name: Import Riot GPG key + shell: gpg --import /tmp/riot-release-key.asc + +- name: Download Riot release + get_url: + url: "{{ riot__release_url }}" + dest: /tmp/ + checksum: "sha512:{{ riot__release_checksum }}" + +- name: Download Riot signature file + get_url: + url: "{{ riot__release_signature_url }}" + dest: /tmp/ + +- name: Verify Riot release with signature file + shell: "gpg --verify /tmp/riot-v{{ riot__release_version }}.tar.gz.asc /tmp/riot-v{{ riot__release_version }}.tar.gz" + +- name: Extract and deploy Riot to the webserver directory + unarchive: + src: /tmp/riot-v{{ riot__release_version }}.tar.gz + dest: "{{ riot__deploy_directory }}" + remote_src: yes + extra_opts: [--strip-components=1] + +- name: Configure Riot + template: + src: config.json + dest: "{{ riot__deploy_directory }}/config.json" + tags: ["riot::configure"]+ \ No newline at end of file diff --git a/ansible/roles/element/templates/config.json b/ansible/roles/element/templates/config.json @@ -0,0 +1,55 @@ +{ + "default_server_config": { + "m.homeserver": { + "base_url": " {{ riot__matrix_homeserver | d('https://matrix.org') }}", + "server_name": "{{ riot__matrix_server_name | d('matrix.org') }}" + }, + "m.identity_server": { + "base_url": "{{ riot__matrix_identity_server | d('https://vector.im') }}" + } + }, + "disable_custom_urls": false, + "disable_guests": true, + "disable_login_language_selector": false, + "disable_3pid_login": false, + "brand": "{{ riot__brand | d('Riot')}}", + "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://riot.im/bugreports/submit", + "defaultCountryCode": "GB", + "showLabsSettings": false, + "features": { + "feature_pinning": "labs", + "feature_custom_status": "labs", + "feature_custom_tags": "labs", + "feature_state_counters": "labs" + }, + "default_federate": true, + "default_theme": "dark", + "roomDirectory": { + "servers": [ + {% for server in riot__server_room_directory|d([]) %} + "{{ server }}", + {% endfor %} + "matrix.org" + ] + }, + "welcomeUserId": "@riot-bot:matrix.org", + "piwik": false, + "enable_presence_by_hs_url": { + "https://matrix.org": false + }, + "settingDefaults": { + "breadcrumbs": true + }, + "jitsi": { + "preferredDomain": "{{ riot__jitsi_url }}" + } +} diff --git a/ansible/roles/riot/defaults/main.yml b/ansible/roles/riot/defaults/main.yml @@ -1,23 +0,0 @@ ---- - -riot__signing_key: https://packages.riot.im/riot-release-key.asc - -riot__release_version: "1.7.5" - -riot__release_checksum: "96c67933f6a32d06bc3f0111660c6f80500a8397e53bbe37c8906f79e76cb18085911d32b55550222891d95340772816802b830f5d81a5d7c7205024a69934eb" - -riot__release_url: "https://github.com/vector-im/element-web/releases/download/v{{ riot__release_version }}/riot-v{{ riot__release_version }}.tar.gz" - -riot__release_signature_url: "https://github.com/vector-im/element-web/releases/download/v{{ riot__release_version }}/riot-v{{ riot__release_version }}.tar.gz.asc" - -riot__deploy_directory: "" - -riot__matrix_homeserver: "https://matrix.org" - -riot__matrix_server_name: "matrix.org" - -riot__matrix_identity_server: "https://vector.im" - -riot__brand: "Riot" - -riot__jitsi_url: "jitsi.modular.im" diff --git a/ansible/roles/riot/tasks/main.yml b/ansible/roles/riot/tasks/main.yml @@ -1,36 +0,0 @@ ---- - -- name: Download Riot GPG key - get_url: - url: "{{ riot__signing_key }}" - dest: /tmp/riot-release-key.asc - -- name: Import Riot GPG key - shell: gpg --import /tmp/riot-release-key.asc - -- name: Download Riot release - get_url: - url: "{{ riot__release_url }}" - dest: /tmp/ - checksum: "sha512:{{ riot__release_checksum }}" - -- name: Download Riot signature file - get_url: - url: "{{ riot__release_signature_url }}" - dest: /tmp/ - -- name: Verify Riot release with signature file - shell: "gpg --verify /tmp/riot-v{{ riot__release_version }}.tar.gz.asc /tmp/riot-v{{ riot__release_version }}.tar.gz" - -- name: Extract and deploy Riot to the webserver directory - unarchive: - src: /tmp/riot-v{{ riot__release_version }}.tar.gz - dest: "{{ riot__deploy_directory }}" - remote_src: yes - extra_opts: [--strip-components=1] - -- name: Configure Riot - template: - src: config.json - dest: "{{ riot__deploy_directory }}/config.json" - tags: ["riot::configure"]- \ No newline at end of file diff --git a/ansible/roles/riot/templates/config.json b/ansible/roles/riot/templates/config.json @@ -1,55 +0,0 @@ -{ - "default_server_config": { - "m.homeserver": { - "base_url": " {{ riot__matrix_homeserver | d('https://matrix.org') }}", - "server_name": "{{ riot__matrix_server_name | d('matrix.org') }}" - }, - "m.identity_server": { - "base_url": "{{ riot__matrix_identity_server | d('https://vector.im') }}" - } - }, - "disable_custom_urls": false, - "disable_guests": true, - "disable_login_language_selector": false, - "disable_3pid_login": false, - "brand": "{{ riot__brand | d('Riot')}}", - "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://riot.im/bugreports/submit", - "defaultCountryCode": "GB", - "showLabsSettings": false, - "features": { - "feature_pinning": "labs", - "feature_custom_status": "labs", - "feature_custom_tags": "labs", - "feature_state_counters": "labs" - }, - "default_federate": true, - "default_theme": "dark", - "roomDirectory": { - "servers": [ - {% for server in riot__server_room_directory|d([]) %} - "{{ server }}", - {% endfor %} - "matrix.org" - ] - }, - "welcomeUserId": "@riot-bot:matrix.org", - "piwik": false, - "enable_presence_by_hs_url": { - "https://matrix.org": false - }, - "settingDefaults": { - "breadcrumbs": true - }, - "jitsi": { - "preferredDomain": "{{ riot__jitsi_url }}" - } -}