--- # Populate the Dockerfile build context with extracted scripts and # config so files/Dockerfile can stay lean (just FROM + COPY + RUN). # Filenames are read from MOODLE_BUILD_FILES (vars/main.yml) — a single # spot consumed here AND referenced literally by the Dockerfile. - name: "🔧 Set fact: moodle compose dir" ansible.builtin.set_fact: _moodle_compose_dir: >- {{ docker_compose.directories.instance | default(lookup('container', application_id, 'directories.instance')) }} - name: "🔧 Set fact: moodle build context base" ansible.builtin.set_fact: _moodle_build_dir: "{{ [_moodle_compose_dir, MOODLE_BUILD_DIR] | path_join }}" - name: "✅ Ensure moodle build context dirs exist" ansible.builtin.file: path: "{{ item }}" state: directory mode: "0755" loop: - "{{ _moodle_build_dir }}" - "{{ [_moodle_build_dir, 'php-conf'] | path_join }}" - "{{ [_moodle_build_dir, 'install'] | path_join }}" - name: "📋 Copy static build assets into compose context" ansible.builtin.copy: src: "{{ [MOODLE_BUILD_DIR, item.path] | path_join }}" dest: "{{ [_moodle_build_dir, item.path] | path_join }}" mode: "{{ item.mode }}" loop: - { path: "{{ MOODLE_BUILD_FILES.entrypoint }}", mode: "0755" } - { path: "{{ MOODLE_BUILD_FILES.config_php }}", mode: "0644" } - { path: "{{ MOODLE_BUILD_FILES.opcache_ini }}", mode: "0644" } - { path: "{{ MOODLE_BUILD_FILES.fpm_pool }}", mode: "0644" } - { path: "{{ MOODLE_BUILD_FILES.install_source }}", mode: "0755" } - { path: "{{ MOODLE_BUILD_FILES.install_oidc }}", mode: "0755" } - { path: "{{ MOODLE_BUILD_FILES.install_mcp }}", mode: "0755" } loop_control: label: "{{ item.path }}" notify: - compose-build - compose-up - name: "📋 Copy msmtprc to {{ MOODLE_MSMTP_ABS }} (Mailu relay for mail() + healthcheck)" stack_host_template: src: "{{ MOODLE_MSMTP_SRC }}" dest: "{{ MOODLE_MSMTP_ABS }}" mode: "0640" vars: sys_svc_mail_msmtp_in_container: true notify: - compose-build - compose-up - name: "📄 Render PHP runtime tuning into compose context" stack_host_template: src: "{{ [MOODLE_BUILD_DIR, MOODLE_BUILD_FILES.runtime_ini ~ '.j2'] | path_join }}" dest: "{{ [_moodle_build_dir, MOODLE_BUILD_FILES.runtime_ini] | path_join }}" mode: "0644" notify: - compose-build - compose-up