spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.76k stars 1.03k forks source link

'matrix is undefined' error at the end of process while obtraining letsencrypt certificates #815

Closed justin108smart closed 1 year ago

justin108smart commented 3 years ago

I defined all variables that the instructions say to add but I am still getting the following output:

TASK [matrix-nginx-proxy : Ensure certbot Docker image is pulled] ** ok: [matrix.mydomain.com]

TASK [matrix-nginx-proxy : Obtain Let's Encrypt certificates] ** fatal: [matrix.mydomain.com]: FAILED! => {"msg": "['{{ matrix.mydomain.com }}', '{{ element.mydomain.com }}', '{{ dimension.mydomain.com }}', '{{ assets.mydomain.com }}', '{{ mydomain.com }}']: 'matrix' is undefined"}

PLAY RECAP ***** matrix.mydomain.com : ok=181 changed=10 unreachable=0 failed=1 skipped=1075 rescued=0 ignored=0

ubuntu@chat:/deploy/matrix-docker-ansible-deploy$

I can provide more info if this gets a response. I don't know what variables I could have possibly missed, I defined everything in the variables mentioned that needed to be defined and a ton in optional variables enabling the various modules.

Any help would be very appreciated.

JW

spantaleev commented 3 years ago

Defining a ton of variables during your initial installation is not recommended.

Start small, get something working, then add more stuff.

It seems like you are using {{ matrix }} somewhere or something. There's no matrix variable. Maybe you meant {{ matrix_domain }}?

Pasting your vars.yml file would be helpful (hiding your secrets, of course).

justin108smart commented 3 years ago

It's not that many variables.

I am not defining matrix anywhere, the one place I mention matrix in the whole vars.yml file is only to define the LetsEncrypt point for matrix.mydomain.com

I've copied the vars.yml file below, i also mention matrix in setup.yml because I had to add matrix.mydomain.com to the top if I remember correctly.

I really appreciate any help you can provide from this, I think it's failing towards the end of the process actually, I've gone through a lot of work on this and I really appreciate your work an what you've put into this cause it's going to be an amazing script process if I can get it working.

vars.yml:

SSL Cert Renewal Emsil

matrix_ssl_lets_encrypt_support_email: 'email@email.com'

A shared secret (between Coturn and Synapse) used for authentication.

You can put any string here, but generating a strong one is preferred (e.g. `$

matrix_coturn_turn_static_auth_secret: 'password'

A secret used to protect access keys issued by the server.

You can put any string here, but generating a strong one is preferred (e.g. `$

matrix_synapse_macaroon_secret_key: 'password'

A Postgres password to use for the superuser Postgres user (called matrix b$

#

The playbook creates additional Postgres users and databases (one for each en$

using this superuser account.

matrix_postgres_connection_password: 'password'

matrix_jitsi_enabled: true

Run bash inventory/scripts/jitsi-generate-passwords.sh to generate these passwords,

or define your own strong passwords manually.

matrix_jitsi_jicofo_component_secret: 'password'

Paste these variables into your inventory/host_vars/matrix.DOMAIN/vars.yml file:

matrix_jitsi_jicofo_component_secret: password matrix_jitsi_jicofo_auth_password: password matrix_jitsi_jvb_auth_password: password matrix_jitsi_jibri_recorder_password: password matrix_jitsi_jibri_xmpp_password: password

matrix_jitsi_enable_auth: true matrix_jitsi_enable_guests: true

matrix_jitsi_web_custom_config_extension: | config.enableLayerSuspension = true;

config.disableAudioLevels = true;

Limit the number of video feeds forwarded to each client

config.channelLastN = 4;

matrix_jitsi_web_config_resolution_width_ideal_and_max: 480 matrix_jitsi_web_config_resolution_height_ideal_and_max: 240

set up Synapse Admin

matrix_synapse_admin_enabled: true

Amazon A3 Configuration

matrix_s3_media_store_enabled: true matrix_s3_media_store_bucket_name: "bucketname" matrix_s3_media_store_aws_access_key: "accesskey" matrix_s3_media_store_aws_secret_key: "secretly" matrix_s3_media_store_region: "us-east-1"

element config info

matrix_client_element_themes_enabled: true

SSL certificate Renewal

matrix_ssl_domains_to_obtain_certificates_for:

Serve Matrix Home Page on Base Domain

matrix_nginx_proxy_base_domain_serving_enabled: true

NGINX Configuration

matrix_nginx_proxy_proxy_matrix_nginx_status_enabled: true

Disable Federation

matrix_synapse_federation_enabled: false

Email Settings

matrix_mailer_sender_address: "email@email.com"

Matrix Registration (allow invite only registration if needed)

matrix_registration_enabled: true

Generate a strong secret using: pwgen -s 64 1.

matrix_registration_admin_secret: "adminsecret"

App Service Webhooks

matrix_appservice_webhooks_enabled: true matrix_appservice_webhooks_api_secret: 'apisecret' matrix_appservice_webhooks_log_level: 'verbose'

beginning of setup.yml

GNU nano 4.8 setup.yml

....and it continues. The only thing that occurs to me is that this setup.yml file, which was mostly auto generated I think besides the minor change i made, has no simple "matrix" definition, maybe that's what it is looking for?

thanks,

JW

spantaleev commented 3 years ago

If this is your first installation, this is really a lot of variables compared to the original 4-5 that our example starts you with.. And thus a lot of potential for you to make a mistake and encounter trouble.


matrix_jitsi_web_custom_config_extension: |
  config.enableLayerSuspension = true;

  config.disableAudioLevels = true;

  # Limit the number of video feeds forwarded to each client
  config.channelLastN = 4;

This is invalid. Namely, the # Limit the number ... comment part. # is not how comments are created in JS. This example has been fixed on our Jitsi docs page since a long time ago (2020-12-07 via 9713ac96177d71cb4e), so your configuration is outdated. I wonder where you got that from and whether it was before that date, or you're looking at some incorrect article now?


matrix_ssl_domains_to_obtain_certificates_for:
  - '{{ matrix.mydomain.com }}'
  - '{{ element.mydomain.com }}'
  - '{{ dimension.mydomain.com }}'
  - '{{ assets.mydomain.com }}'
  - '{{ mydomain.com }}'

This is also incorrect. {{ and }} are markers for creating Jinja2 variables. Yet, you're attempting to define static values. Remove {{ and }} from this. This is what you want:

matrix_ssl_domains_to_obtain_certificates_for:
  - 'matrix.mydomain.com'
  - 'element.mydomain.com'
  - 'dimension.mydomain.com'
  - 'assets.mydomain.com'
  - 'mydomain.com'

I see you've modified setup.yml and you've made it invalid. You should restore it.

You should not modify anything in the playbook besides your own inventory/host_vars/matrix.DOMAIN/vars.yml file and inventory/hosts.

Unless you plan to introduce new features or fix bugs and contribute these back to us.

Normally, there's no reason to edit anything else besides the 2 files I mentioned.