Commit Graph
17 Commits
Author SHA1 Message Date
kevinveenbirkenbachandClaude Opus 5 575a5a87ac refactor(layout): sort shipped scripts by language and split the unit suite
Every script a role ships now lives under `files/<language>/`, and the unit
suite is split the same way: `tests/unit/python/` beside new sibling trees for
the other languages. `tests/lint/filesystem/test_role_files_layout.py` keeps it
that way; directories whose shape is dictated from outside carry a `.nocheck`
naming the constraint (Docker build contexts, WordPress mu-plugins, the Joomla
extension, Odoo addons, Playwright suites, the `files/test/test.sh` harness
that `test-e2e-cli` resolves generically).

This cannot be applied in halves. Moving a file and repointing what names it
are the same change: 14 references resolve only at deploy time, so the tree is
green either before or after, never between.

Those 14 were found by static resolution over every reference class, not by the
test suite -- a full `make quality-high` was green while all of them were
broken:

  * 7 `src:` values built from a role variable holding a bare filename
    (svc-bkp-remote-2-local, decidim, espocrm, friendica, joomla, pixelfed x2).
    The variable doubles as the destination name inside the container, so the
    language segment belongs at the call site, not in the variable.
  * `sys-service/tasks/04_base.yml` resolved every consumer's systemd script
    through `first_found(..., errors='strict')` over `files/script.{sh,py}`.
    18 roles ship exactly that and have no template fallback: the play would
    have died on each.
  * `sys-front-inj-javascript` fell back to `<role>/files/javascript.js`; the
    interface now reads `files/javascript/javascript.js`.
  * `sys-front-inj-logout/templates/head_sub.j2` built the cache-busting mtime
    path through `path_absolute(... 'files', ...)`.
  * 4 `ansible.builtin.script:` invocations naming a bare command
    (pull.py, prune.sh, set_postgres_superuser_password.sh, ganesha-serve.sh).
  * `dev-python/files/shell/install.sh` pointed at a sibling role's script.

Depth-dependent paths inside the moved trees were bumped accordingly: 59
`parents[N]` computations, 12 relative climbs, and the per-role recover CLI,
whose path `cli/administration/recover/recoverers.py` still assembled from the
pre-move location.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 01:31:09 +02:00
kevinveenbirkenbachandClaude Fable 5 40e553069d refactor(structure): nest prefix-grouped sibling files into subfolders
Move files that share a delimiter-bounded name prefix within a folder (threshold 2) into a subfolder named after the prefix, dropping the prefix from the filename. Covers plugins/filter (docker, generate, has, merge, get/all), env handler subpackages, utils/roles/entity, utils/tests/swarm/write, role SQL/scripts/templates, keycloak/mailu task-includes, shared tasks/utils/load, and CI scripts. Update every import, query_file/script/include_tasks/src/lookup target, compose bind mount, and python -m path to the new locations.

Extend the prefix-grouped-files lint to threshold 2 with dir-level .nocheck and file-head nocheck opt-outs, and skip groups whose shortest member's stem equals the shared prefix. Keep flat only where a loader forbids nesting: WordPress mu-plugins and the docs/requirements namespace. Ansible filter discovery is recursive, so nested filters stay Jinja-resolvable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 20:00:03 +02:00
kevinveenbirkenbachandClaude Opus 4.8 c057b1a1c8 fix(roles): never quote container_address swarm resolver fragments
In swarm mode the container_address lookup returns a $(/usr/bin/resolve-container-id ...) fragment that must expand at exec time; piping it through Jinja quote hands docker the literal string and every exec fails with 'No such container' (broke all three snipe-it CI variants). Remove the quote at the seven snipe-it sites and the live matrix/openproject sites, convert openproject's argv exec to shell so the fragment can expand, split the matrix bridge restart per deployment mode with a manager gate, and mark the compose-only or eval-contract sites with nocheck. A new lint (container-address-quote) bans the pattern repo-wide.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 17:30:36 +02:00
kevinveenbirkenbachandClaude Opus 4.8 cddb0dc59b feat(lint): require emoji-prefixed task/step/job names + convert existing
Add tests/lint/repository/test_name_emoji_and_length.py: every Ansible task
name and GitHub Actions workflow/job/step name must start with an emoji (first
char not 0-9/A-Za-z) and be <= 80 chars.

- emit emoji names at the source: cli/build/include generator now writes
  "🔧 setup <app>" / "🚿 flush handlers after <app>" so generated
  tasks/groups/*-roles.yml satisfy the convention too
- convert existing task/step/job/workflow names to emoji-prefixed, choosing a
  task-fitting icon per action (📦 install, ✅ ensure, 🔍 probe, 🥾 bootstrap,
  🚀 deploy, 🧩 service-module load, ⬇️ checkout, 📂 include-routines, ...)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 22:45:06 +02:00
kevinveenbirkenbachandClaude Opus 4.7 a212ed9df2 refactor(roles): swarm-aware exec routing in 7 roles
Replace compose-mode-specific `{{ BIN_COMPOSE }} exec ... {{ SERVICE }}`
+ `args.chdir: lookup('container', ..., 'directories.instance')`
invocations with `container exec -i {{ ..._CONTAINER_ADDRESS | quote }}`
(plus `--workdir` flag where chdir was load-bearing). The container
exec wrapper resolves the actual runtime container name on both
compose (compose-suffixed name) and swarm (stack-task-id-suffixed
name) via the `container_address` lookup, so the task no longer
assumes the compose-mode service-name address.

Pure-syntax adaptation only — no behavioural change, same register /
when / failed_when / no_log semantics preserved on every task.

Roles touched (12 task files):
- web-app-espocrm (1)
- web-app-friendica (2)
- web-app-listmonk (1)
- web-app-openproject (2)
- web-app-snipe-it (3)
- web-app-taiga (1)
- web-app-wordpress (2)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-14 19:08:46 +02:00
kevinveenbirkenbachandClaude Opus 4.7 c52e4269bf chore(tooling): integrate mbake (Makefile linter/formatter) + working-tree drift sync
Makefile lint integration:
* scripts/install/lint.sh: replace the prior checkmake binary install with
  ensure_mbake (mbake is pip-installable, parses our Makefile correctly
  whereas checkmake bailed on .ONESHELL: / .SHELLFLAGS: / ifneq).
* scripts/lint/makefile.sh: new runner — `mbake format --check Makefile`
  reports formatting drift and missing .PHONY declarations.
* scripts/lint/autoformat.sh: add a two-pass `mbake format Makefile`
  (mbake's formatter is not strictly idempotent on the first pass).
* Makefile: split the multi-line `.PHONY:` block into 18 single-line
  `.PHONY:` declarations so mbake's parser can validate it; add the
  previously-missing `install-python-dev` and `build-dependency` PHONY
  targets; add `lint-makefile` aggregate-and-direct target.
* .pre-commit-config.yaml: new make-lint-makefile hook scoped to
  `^Makefile$`.
* .github/workflows/lint-makefile.yml: new CI workflow (pip-install mbake
  + make lint-makefile).
* .github/workflows/ci-orchestrator.yml: wire lint-makefile into
  lint-gate.needs.

Misc:
* .gitignore: add roles/importer_result.json (tooling artefact written by
  galaxy-importer when it runs in roles/).

Plus working-tree drift across roles/, group_vars/, inventories/, and
tasks/ that accumulated from the make-test setup phase regenerating
generated artefacts during recent test runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 00:32:44 +02:00
kevinveenbirkenbachandClaude Opus 4.7 5689f5b636 refactor(lint): forbid multi-line PHP in *.sh + transform 3 violators
New repository lint catches multi-line `php -r '...'` and `php <<EOF`
bodies inside *.sh / *.bash files under roles/, scripts/, .github/.
The escape-layering of bash + (template/YAML) + PHP makes such blocks
brittle and quote-injection-prone. The fix is to drop the PHP body
into a sibling files/<name>.php and pipe it via stdin (preferred from
Ansible: `shell:` with `stdin: "{{ lookup('file', '<name>.php') }}"`).

Three pre-existing violations transformed by replacing the .sh wrapper
with one or more .php sidecars and rewriting the caller task:

  - web-app-espocrm: set_siteurl.sh -> set_siteurl.php
    Single shell task pipes the .php via stdin; ESPOCRM_URL forwarded
    through `compose exec -e` so the URL never lands in the PHP literal.

  - web-app-snipe-it: ldap.sh (wrapper + 2 PHP blocks) -> 3 ansible
    tasks + wait_settings.php + apply_ldap_config.php
    The bash retry-loop becomes Ansible retries/delay/until; LDAP env
    vars are forwarded via `compose exec -e` (not via task-level
    environment: on a wrapper script). APP_KEY is preserved for
    Laravel Crypt::encrypt.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:26:34 +02:00
kevinveenbirkenbach a55c99ef62 refactor(compose): replace docker lookup with container and unify compose paths
- Rename lookup plugin from `docker` to `container`
- Switch all lookups from `lookup('docker', ...)` to `lookup('container', ...)`
- Normalize compose file keys:
  - docker_compose → compose
  - docker_compose_override → compose_override
  - docker_compose_ca_override → compose_ca_override
- Centralize compose path resolution via docker_paths_utils
- Update compose_file_args to always derive paths from DIR_COMPOSITIONS
- Align all roles, templates, and vars with container/compose naming
- Update and rename unit tests accordingly

This prepares the codebase for engine-agnostic container backends
(e.g. Docker ↔ Podman) and removes legacy docker-specific assumptions.

https://chatgpt.com/share/6987a7cc-d374-800f-99ad-bb4c8f92c59e
2026-02-07 21:59:39 +01:00
kevinveenbirkenbach 26a5b159e0 refactor(docker-lookup): replace want= syntax with path-based access
- Replace lookup('docker', ..., want='...') with lookup('docker', ..., 'path')
- Allow both top-level keys (directories/files) and dotted paths
- Simplify docker lookup API and reduce lazy dict propagation
- Update unit tests to reflect new lookup semantics

https://chatgpt.com/share/6984ccea-8290-800f-a6d7-ec0e94df95a0
2026-02-05 18:45:43 +01:00
kevinveenbirkenbach 56aea31667 refactor(docker): replace docker_compose vars with docker lookup across roles
Remove implicit docker_compose variable usage and resolve all docker paths
(files, directories, env) via lookup('docker', application_id).
This prevents scope leakage, centralizes path resolution, and makes docker
context deterministic across roles and handlers.

https://chatgpt.com/share/6984ccea-8290-800f-a6d7-ec0e94df95a0
2026-02-05 18:15:10 +01:00
kevinveenbirkenbach 52e05c38f6 fix(snipe-it/ldap): normalize firstname attribute to lowercase to match LDAP result keys
Snipe-IT expects LDAP attribute keys in lowercase when mapping user fields.
Previously, the FIRSTNAME attribute was passed through unchanged (e.g. givenName),
causing LDAP sync to fail with "The first name field is required" despite the
attribute being present in LDAP.

This change introduces a dedicated variable and normalizes the firstname
attribute to lowercase, aligning Ansible configuration with Snipe-IT's LDAP
import behavior without modifying filters or LDAP data.

https://chatgpt.com/share/6978caca-9170-800f-b227-037c2f4bbf1d
2026-01-27 15:25:10 +01:00
kevinveenbirkenbach f4681f4f95 fix(snipe-it): make LDAP auth filter configurable and persist UI-compatible settings
- Make ldap_auth_filter_query explicitly configurable instead of hardcoded
- Pass LDAP auth filter via Ansible to Snipe-IT settings model
- Use minimal LDAP filter fragment for correct Snipe-IT query composition
- Fail fast if LDAP_AUTH_FILTER_QUERY is missing
- Align LDAP configuration with actual UI persistence behavior

https://chatgpt.com/share/6978a387-bd50-800f-b804-e1115a9434cb
2026-01-27 12:37:30 +01:00
kevinveenbirkenbach 9b0a8f4797 fix(snipe-it): store LDAP bind password UI-compatible (serialize + Crypt::encrypt)
- Switch LDAP bind password handling to Base64 input
- Decode, serialize, and encrypt password exactly like Snipe-IT UI
- Replace DB updates with Settings model to follow UI code path
- Remove artisan tinker usage for deterministic execution
- Use optimize:clear for proper cache reset
- Align LDAP filter variable naming in Ansible task

https://chatgpt.com/share/6977bbd5-8eb4-800f-9e32-5b17898d79a7
2026-01-26 20:08:58 +01:00
kevinveenbirkenbach af9d3e00fe feat(snipe-it): refactor LDAP setup into dedicated script and modernize docker compose usage
- Extract LDAP configuration logic into reusable ldap.sh script
- Pass all LDAP and auth parameters via environment for clarity and safety
- Ensure idempotent wait for settings table before applying LDAP config
- Encrypt and persist LDAP bind password via Laravel Crypt API
- Clear Laravel config and application cache after LDAP changes
- Replace deprecated docker-compose calls with docker compose
- Simplify Ansible LDAP task to a single script invocation

https://chatgpt.com/share/6977420f-d514-800f-b408-a91ed4b47f83
2026-01-26 11:29:29 +01:00
kevinveenbirkenbach e79f7311d6 Corrected command 2026-01-25 20:41:56 +01:00
kevinveenbirkenbach c5945d9212 - Increase container resource limits for Snipe-IT (CPU, memory, pids)
- Fix PHP CLI OOM during db:seed by explicitly setting memory_limit
- Remove forced www-data execution for artisan commands to avoid permission issues
- Simplify service availability check (root URL instead of /login)
- Align LDAP and cache-related artisan commands with container defaults
- Normalize inventory sample credentials quoting

https://chatgpt.com/share/69767129-4240-800f-a69c-b2647a1e5083
2026-01-25 20:38:08 +01:00
kevinveenbirkenbach 99af14ead7 web-app-snipe-it: add installation phase with migrations and seeding before LDAP setup
- introduce installation procedure (container wait, login check, migrate, seed)
- move LDAP configuration into dedicated post-install step
- make service name configurable via SNIPE_IT_SERVICE
- unify artisan execution via service variable
- adjust oauth2 origin host to snipe-it service
- remove obsolete Administration.md

https://chatgpt.com/share/696d6d57-8c3c-800f-9ac9-9578ff2e2491
2026-01-19 00:31:29 +01:00