From c699983b80ef2bf9cfe7f8150f1219469e4c92b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 18 Nov 2026 15:25:34 +0100 Subject: [PATCH] Add optional mount of template overrides and use `chill` in env templates - add `load_template_override` (default false) to `default_chill`: controls the creation and the mount of the `templates` directory - use `chill.chill_config` instead of `item.chill_config` in env_file.env, rabbitmq.env and postgres.env Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01VnXP3D1srf5k8MrtPFUz93 --- defaults/main.yml | 2 ++ tasks/chill/main.yml | 8 ++++++++ templates/compose.yaml | 2 ++ templates/env_file.env | 8 ++++---- templates/postgres.env | 6 +++--- templates/rabbitmq.env | 4 ++-- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 96dcde6..dc497e3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -25,6 +25,8 @@ default_chill: expose_port: false # can be false, or the port number # use rabbitmq as message broker. If not in use, it will be replaced by doctrine rabbitmq_install: true + # mount the directory 'templates' (twig overrides) into the app containers. false = do not mount + load_template_override: false proxy_ips: # 127.0.0.1 is always added - 192.168.0.0/16 diff --git a/tasks/chill/main.yml b/tasks/chill/main.yml index a8c93b8..6d7f9f0 100644 --- a/tasks/chill/main.yml +++ b/tasks/chill/main.yml @@ -45,6 +45,14 @@ owner: "82" mode: '0500' +- name: Create directory for template overrides (mounted in the app container) + ansible.builtin.file: + path: "{{ install_dir }}/{{ chill['chill_environment'] }}/templates" + state: directory + mode: '0755' + owner: "{{ as_user }}" + when: chill.load_template_override + - name: Copy configuration files ansible.builtin.template: src: "config/prod/{{ file }}" diff --git a/templates/compose.yaml b/templates/compose.yaml index 2bf9406..644f89f 100644 --- a/templates/compose.yaml +++ b/templates/compose.yaml @@ -50,7 +50,9 @@ services: volumes: - './config/prod:/var/www/app/config/packages/prod:ro' - '/var/log/chill:/var/www/app/var/log:rw' + {% if chill.load_template_override +%} - './templates:/var/www/app/templates:ro' + {%+ endif %} - '{{ doc_storage_dir }}/{{ chill['chill_environment'] }}:/var/storage:rw' links: - redis diff --git a/templates/env_file.env b/templates/env_file.env index 28d94b2..53b2331 100644 --- a/templates/env_file.env +++ b/templates/env_file.env @@ -36,11 +36,11 @@ ADMIN_PASSWORD_2={{ chill.chill_config.admin_password_2 }} {% if chill.chill_config.admin_password_3 is defined -%} ADMIN_PASSWORD_3={{ chill.chill_config.admin_password_3 }} {% endif -%} -{% if item.chill_config.admin_password_4 is defined -%} -ADMIN_PASSWORD_4={{ item.chill_config.admin_password_4 }} +{% if chill.chill_config.admin_password_4 is defined -%} +ADMIN_PASSWORD_4={{ chill.chill_config.admin_password_4 }} {% endif -%} -{% if item.chill_config.admin_password_5 is defined -%} -ADMIN_PASSWORD_5={{ item.chill_config.admin_password_5 }} +{% if chill.chill_config.admin_password_5 is defined -%} +ADMIN_PASSWORD_5={{ chill.chill_config.admin_password_5 }} {% endif -%} MAILER_DSN={{ chill.chill_config.mailer_dsn }} MAILER_URL={{ chill.chill_config.mailer_url }} diff --git a/templates/postgres.env b/templates/postgres.env index b5b06f2..98140c1 100644 --- a/templates/postgres.env +++ b/templates/postgres.env @@ -1,4 +1,4 @@ # this file is managed by ansible. Do not edit it by hand -POSTGRES_DB={{ item.chill_config.database_name }} -POSTGRES_USER={{ item.chill_config.database_user }} -POSTGRES_PASSWORD={{ item.chill_config.database_password }} +POSTGRES_DB={{ chill.chill_config.database_name }} +POSTGRES_USER={{ chill.chill_config.database_user }} +POSTGRES_PASSWORD={{ chill.chill_config.database_password }} diff --git a/templates/rabbitmq.env b/templates/rabbitmq.env index f288e2f..a878b21 100644 --- a/templates/rabbitmq.env +++ b/templates/rabbitmq.env @@ -1,3 +1,3 @@ # this file is managed by ansible. Do not edit it by hand. -RABBITMQ_DEFAULT_USER={{ item.chill_config.rabbitmq_user }} -RABBITMQ_DEFAULT_PASS={{ item.chill_config.rabbitmq_password }} \ No newline at end of file +RABBITMQ_DEFAULT_USER={{ chill.chill_config.rabbitmq_user }} +RABBITMQ_DEFAULT_PASS={{ chill.chill_config.rabbitmq_password }} \ No newline at end of file