Files
computer-playbook/roles/web-app-moodle/tasks/03_ownership.yml
kevinveenbirkenbachandClaude Opus 4.8 4039313266 refactor(tasks): enforce and apply a single task-file numbering scheme
Add tests/lint/repository/test_task_file_numbering.py: numbered task
files use exactly two leading digits, a numbered *_core.yml must be
00_core.yml, per directory the numbers are unique/consecutive and start
at 01 (00 with a core file), numbered includes appear in ascending
order, and shared helpers live in tasks/utils/ instead of the numbered
chain.

Apply it across every role: rename NN_core.yml to 00_core.yml with a
consecutive down-shift of the siblings, move letter-suffix children into
a subdirectory named after their parent task, relocate helpers included
from more than one place into tasks/utils/, and update every reference
(include_tasks, path_absolute, .ansible-lint-ignore, requirement docs).
Legacy narration comments in the touched files are deleted; the upstream
xwiki.properties reference block opts out via nocheck. The unused
MAILU_IP6_PUBLIC var (only ever named in now-removed comments) is dropped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 20:01:31 +02:00

39 lines
1.9 KiB
YAML

---
# Set ownership/permissions on Moodle volumes after first start. The
# entrypoint already chowns on every boot, but this is a belt-and-
# suspenders pass for re-deploys after operator-driven file edits.
#
# Code dir uses world-readable perms (0755 dirs / 0644 files) so the
# nginx sidecar (alpine, runs as uid 101) can serve static assets and
# stream PHP files to FPM. Data dir stays restrictive (0770 / 0660)
# because only Moodle FPM (running as MOODLE_RUNTIME_USER) needs to
# read/write user-uploaded content.
- name: "✅ Ensure ownership is correct on Moodle code dir"
shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} chown -R {{ MOODLE_RUNTIME_USER_GROUP }} {{ MOODLE_CODE_DIR }}"
changed_when: false
- name: "✅ Ensure ownership is correct on Moodle data dir"
shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} chown -R {{ MOODLE_RUNTIME_USER_GROUP }} {{ MOODLE_DATA_DIR }}"
changed_when: false
- name: "📁 Code dir: 0755 dirs (nginx-readable)"
shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -type d -exec chmod 0755 {} \\;"
changed_when: false
- name: "📁 Code dir: 0644 files (nginx-readable)"
shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -type f -exec chmod 0644 {} \\;"
changed_when: false
- name: "📁 Code dir: 0640 config.php (FPM-only)"
shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} chmod 0640 {{ MOODLE_CONFIG }}"
changed_when: false
- name: "📁 Data dir: 0770 dirs (FPM-only)"
shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_DATA_DIR }} -type d -exec chmod 0770 {} \\;"
changed_when: false
- name: "📁 Data dir: 0660 files (FPM-only)"
shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_DATA_DIR }} -type f -exec chmod 0660 {} \\;"
changed_when: false