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.92k stars 1.05k forks source link

undefined variable "devture_systemd_docker_base_container_stop_grace_time_seconds" when upgrading. #3061

Open patrickstump opened 11 months ago

patrickstump commented 11 months ago

Describe the bug

While upgrading from commit "3dc77c4f9a1277f2338f2cd3664186fd94b93292" (version bump to Synapse 1.96.1) to commit 9e35ceee910324da658ac93811acc6a16301a74f (upgrade Traefik), I received the ansible error undefined variable for "devture_systemd_docker_base_container_stop_grace_time_seconds".

TASK [galaxy/redis : Ensure Redis systemd installed] **********************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleUndefinedVariable: {{ [devture_systemd_docker_base_container_stop_grace_time_seconds, 30] | max }}: 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined. 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined. {{ [devture_systemd_docker_base_container_stop_grace_time_seconds, 30] | max }}: 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined. 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined
fatal: [matrix.example.lan]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: {{ [devture_systemd_docker_base_container_stop_grace_time_seconds, 30] | max }}: 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined. 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined. {{ [devture_systemd_docker_base_container_stop_grace_time_seconds, 30] | max }}: 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined. 'devture_systemd_docker_base_container_stop_grace_time_seconds' is undefined"}

When I clone the project and search for "devture_systemd_docker_base_container_stop_grace_time_seconds", I find its use in several .j2 files, but no default or setting.

When I use a search engine for the variable I do find it being set at github com.devture.ansible.role.postgres which is a commit in the postgres role to set the default.

I did read the note that this role installs other services and the issue may be in another service. However, when i search i find this variable in many of the roles, so it seemed appropriate to put it at the top project. My apologies if this is incorrect.

There are many, but one occurrence of this is in another role is role matrix-synapse systemd template.

It appears the files were modified with this variable at Stop containers gracefully, instead of outright killing them. I cannot find a default setting in that commit.

Work Around

I manually set devture_systemd_docker_base_container_stop_grace_time_seconds: 30 in my vars file.

To Reproduce My vars.yml file looks like this:

---
# Config file for Matrix role files

## Matrix Base Role 
matrix_domain: example.lan
matrix_admin: "@sysadmin:{{ matrix_domain }}"

matrix_homeserver_implementation: synapse
matrix_playbook_reverse_proxy_type: playbook-managed-traefik
devture_traefik_config_certificatesResolvers_acme_email: "sysadmin@example.lan"

# Use workers instead of single thread
matrix_synapse_workers_enabled: true

###################################
# Enable Various Components
##################################
# Enable matrix admin web server
matrix_synapse_admin_enabled: true

matrix_synapse_password_config_localdb_enabled: true # Disable local matrix database auth

######################
# Docker Customization
#
matrix_synapse_docker_image_customized_force_source: true
matrix_synapse_container_image_customizations_enabled: true
# Add Our CA Certificate
matrix_synapse_container_image_customizations_dockerfile_body_custom: |
  ADD example-ca.crt /usr/local/share/ca-certificates
  RUN update-ca-certificates

I am cloning the head of master, which is currently da27655ef34999fa924bc0a5e641dbd9ba06f133 and performing the install/upgrade

Expected behavior

Installation/upgrade to complete.

Matrix Server:

Additional context

I do have additional services being configured, but they did not seem involved when researching this issue as it appears to be a default not being set for an ansible variable.

spantaleev commented 11 months ago

Have you recently executed just roles or make roles to update the roles used by the playbook?

cherbst commented 10 months ago

I can confirm that make roles solves the problem