From d9c9b9ddd083448ebb76681c5e842b8b130f49f5 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 21 Dec 2023 19:50:19 +0100 Subject: [PATCH] Matrix debugging --- group_vars/all | 6 +- roles/docker-matrix/tasks/main.yml | 37 ++++++++++- roles/docker-matrix/templates/hosts.yml.j2 | 73 +--------------------- roles/docker-matrix/templates/vars.yml.j2 | 71 +++++++++++++++++++++ 4 files changed, 112 insertions(+), 75 deletions(-) create mode 100644 roles/docker-matrix/templates/vars.yml.j2 diff --git a/group_vars/all b/group_vars/all index 8143caf7..e340f510 100644 --- a/group_vars/all +++ b/group_vars/all @@ -143,4 +143,8 @@ pixelfed_app_name: "Pictures" top_domain: "localhost" # Prints well formated debug information -verbose: false +verbose: false + +# Tags used by the matrix playbook +# For the initial update use: install-all,ensure-matrix-users-created,start +matrix_playbook_tags: "setup-all,start" \ No newline at end of file diff --git a/roles/docker-matrix/tasks/main.yml b/roles/docker-matrix/tasks/main.yml index 5cd2cb2b..27441e25 100644 --- a/roles/docker-matrix/tasks/main.yml +++ b/roles/docker-matrix/tasks/main.yml @@ -23,11 +23,13 @@ - name: protect inventory directory file: path: "{{ matrix_inventory_tmp_dir.path }}" - mode: '0700' # Nur der Besitzer kann lesen, schreiben und ausführen + mode: '0700' delegate_to: localhost become: false -- name: set the hosts path +# Host file + +- name: set the hosts files path set_fact: hosts_path: "{{ matrix_inventory_tmp_dir.path }}/hosts.yml" @@ -38,6 +40,31 @@ become: false delegate_to: localhost +# Vars file + +- name: set the vars folder path + set_fact: + vars_folder_path: "{{ matrix_inventory_tmp_dir.path }}/host_vars/{{inventory_hostname}}/" + +- name: create vars directory + file: + path: "{{vars_folder_path}}" + mode: '0700' + delegate_to: localhost + become: false + +- name: set the vars path + set_fact: + vars_file_path: "{{ vars_folder_path }}vars.yml" + +- name: create vars.yml + template: + src: "vars.yml.j2" + dest: "{{vars_file_path}}" + become: false + delegate_to: localhost + + - name: show variable information debug: msg: "hosts_path: {{hosts_path}}\nmatrix_inventory_tmp_dir:{{ matrix_inventory_tmp_dir }}" @@ -49,6 +76,12 @@ chdir: "{{ local_repository_directory }}" become: false +- name: play matrix-docker-ansible-deploy + local_action: "command ansible-playbook -i {{hosts_path}} {{local_repository_directory}}/setup.yml -vvv --tags={{matrix_playbook_tags}}" + become: false + + + #- name: delete inventory directory # file: # path: "{{ matrix_inventory_tmp_dir.path }}" diff --git a/roles/docker-matrix/templates/hosts.yml.j2 b/roles/docker-matrix/templates/hosts.yml.j2 index 12a5dfb5..52aff1d3 100644 --- a/roles/docker-matrix/templates/hosts.yml.j2 +++ b/roles/docker-matrix/templates/hosts.yml.j2 @@ -5,75 +5,4 @@ matrix_servers: ansible_ssh_user: administrator become: true become_user: root - ansible_become_password: "{{ansible_become_password}}" -# The bare domain name which represents your Matrix identity. -# Matrix user ids for your server will be of the form (`@user:`). -# -# Note: this playbook does not touch the server referenced here. -# Installation happens on another server ("matrix."). -# -# If you've deployed using the wrong domain, you'll have to run the Uninstalling step, -# because you can't change the Domain after deployment. -# -# Example value: example.com - matrix_domain: "{{synapse_domain}}" - -# The Matrix homeserver software to install. -# See: -# - `roles/custom/matrix-base/defaults/main.yml` for valid options -# - the `docs/configuring-playbook-IMPLEMENTATION_NAME.md` documentation page, if one is available for your implementation choice - matrix_homeserver_implementation: synapse - -# A secret used as a base, for generating various other secrets. -# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`). - matrix_homeserver_generic_secret_key: "{{matrix_generic_secret_key}}" - -# By default, the playbook manages its own Traefik (https://doc.traefik.io/traefik/) reverse-proxy server. -# It will retrieve SSL certificates for you on-demand and forward requests to all other components. -# For alternatives, see `docs/configuring-playbook-own-webserver.md`. - matrix_playbook_reverse_proxy_type: playbook-managed-traefik - -# Ensure that public urls use https - matrix_playbook_ssl_enabled: true - -# Disable the web-secure (port 443) endpoint, which also disables SSL certificate retrieval - devture_traefik_config_entrypoint_web_secure_enabled: false - -# If your reverse-proxy runs on another machine, consider using `0.0.0.0:81`, just `81` or `SOME_IP_ADDRESS_OF_THIS_MACHINE:81` - devture_traefik_container_web_host_bind_port: "127.0.0.1:{{http_port}}" - -# We bind to `127.0.0.1` by default (see above), so trusting `X-Forwarded-*` headers from -# a reverse-proxy running on the local machine is safe enough. - devture_traefik_config_entrypoint_web_forwardedHeaders_insecure: true - -# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains. -# -# In case SSL renewal fails at some point, you'll also get an email notification there. -# -# If you decide to use another method for managing SSL certificates (different than the default Let's Encrypt), -# you won't be required to define this variable (see `docs/configuring-playbook-ssl-certificates.md`). -# -# Example value: someone@example.com - devture_traefik_config_certificatesResolvers_acme_email: "{{administrator_email}}" - -# A Postgres password to use for the superuser Postgres user (called `matrix` by default). -# -# The playbook creates additional Postgres users and databases (one for each enabled service) -# using this superuser account. - devture_postgres_connection_password: "{{matrix_postgres_password}}" - -# By default, we configure Coturn's external IP address using the value specified for `ansible_host` in your `inventory/hosts` file. -# If this value is an external IP address, you can skip this section. -# -# If `ansible_host` is not the server's external IP address, you have 2 choices: -# 1. Uncomment the line below, to allow IP address auto-detection to happen (more on this below) -# 2. Uncomment and adjust the line below to specify an IP address manually -# -# By default, auto-detection will be attempted using the `https://ifconfig.co/json` API. -# Default values for this are specified in `matrix_coturn_turn_external_ip_address_auto_detection_*` variables in the Coturn role -# (see `roles/custom/matrix-coturn/defaults/main.yml`). -# -# If your server has multiple IP addresses, you may define them in another variable which allows a list of addresses. -# Example: `matrix_coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']` -# -# matrix_coturn_turn_external_ip_address: '' \ No newline at end of file + ansible_become_password: "{{ansible_become_password}}" \ No newline at end of file diff --git a/roles/docker-matrix/templates/vars.yml.j2 b/roles/docker-matrix/templates/vars.yml.j2 new file mode 100644 index 00000000..beb9c2c8 --- /dev/null +++ b/roles/docker-matrix/templates/vars.yml.j2 @@ -0,0 +1,71 @@ +# The bare domain name which represents your Matrix identity. +# Matrix user ids for your server will be of the form (`@user:`). +# +# Note: this playbook does not touch the server referenced here. +# Installation happens on another server ("matrix."). +# +# If you've deployed using the wrong domain, you'll have to run the Uninstalling step, +# because you can't change the Domain after deployment. +# +# Example value: example.com +matrix_domain: "{{synapse_domain}}" + +# The Matrix homeserver software to install. +# See: +# - `roles/custom/matrix-base/defaults/main.yml` for valid options +# - the `docs/configuring-playbook-IMPLEMENTATION_NAME.md` documentation page, if one is available for your implementation choice +matrix_homeserver_implementation: synapse + +# A secret used as a base, for generating various other secrets. +# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`). +matrix_homeserver_generic_secret_key: "{{matrix_generic_secret_key}}" + +# By default, the playbook manages its own Traefik (https://doc.traefik.io/traefik/) reverse-proxy server. +# It will retrieve SSL certificates for you on-demand and forward requests to all other components. +# For alternatives, see `docs/configuring-playbook-own-webserver.md`. +matrix_playbook_reverse_proxy_type: playbook-managed-traefik + +# Ensure that public urls use https +matrix_playbook_ssl_enabled: true + +# Disable the web-secure (port 443) endpoint, which also disables SSL certificate retrieval +devture_traefik_config_entrypoint_web_secure_enabled: false + +# If your reverse-proxy runs on another machine, consider using `0.0.0.0:81`, just `81` or `SOME_IP_ADDRESS_OF_THIS_MACHINE:81` +devture_traefik_container_web_host_bind_port: "127.0.0.1:{{http_port}}" + +# We bind to `127.0.0.1` by default (see above), so trusting `X-Forwarded-*` headers from +# a reverse-proxy running on the local machine is safe enough. +devture_traefik_config_entrypoint_web_forwardedHeaders_insecure: true + +# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains. +# +# In case SSL renewal fails at some point, you'll also get an email notification there. +# +# If you decide to use another method for managing SSL certificates (different than the default Let's Encrypt), +# you won't be required to define this variable (see `docs/configuring-playbook-ssl-certificates.md`). +# +# Example value: someone@example.com +devture_traefik_config_certificatesResolvers_acme_email: "{{administrator_email}}" + +# A Postgres password to use for the superuser Postgres user (called `matrix` by default). +# +# The playbook creates additional Postgres users and databases (one for each enabled service) +# using this superuser account. +devture_postgres_connection_password: "{{matrix_postgres_password}}" + +# By default, we configure Coturn's external IP address using the value specified for `ansible_host` in your `inventory/hosts` file. +# If this value is an external IP address, you can skip this section. +# +# If `ansible_host` is not the server's external IP address, you have 2 choices: +# 1. Uncomment the line below, to allow IP address auto-detection to happen (more on this below) +# 2. Uncomment and adjust the line below to specify an IP address manually +# +# By default, auto-detection will be attempted using the `https://ifconfig.co/json` API. +# Default values for this are specified in `matrix_coturn_turn_external_ip_address_auto_detection_*` variables in the Coturn role +# (see `roles/custom/matrix-coturn/defaults/main.yml`). +# +# If your server has multiple IP addresses, you may define them in another variable which allows a list of addresses. +# Example: `matrix_coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']` +# +# matrix_coturn_turn_external_ip_address: '' \ No newline at end of file