Commit Graph
2780 Commits
Author SHA1 Message Date
kevinveenbirkenbach c9489eb5dd feat(lookup): add domain() lookup plugin with unit tests
Introduce a new Ansible lookup plugin `domain()` that resolves the primary
domain directly from the `domains` variable using only `application_id`.
Includes comprehensive unit tests covering string, list, dict, and error cases.

https://chatgpt.com/share/6985ef1e-11b8-800f-b231-52523055060b
2026-02-06 14:39:32 +01:00
kevinveenbirkenbach 9701eefe99 refactor(compose): rename compose_f_args lookup to compose_file_args
https://chatgpt.com/share/6985ed13-7c98-800f-bb5f-e5832f7c094c
2026-02-06 14:30:51 +01:00
kevinveenbirkenbach 8ba071da24 refactor(tls): rename cert_plan lookup to cert
Rename the certificate planning lookup from cert_plan to cert to better reflect
its role as the canonical certificate resolver.

This change updates:
- lookup plugin filename and error prefixes
- all lookup usages across roles and templates
- unit tests and internal documentation references
- CHANGELOG to reflect the new public lookup name

No functional behavior changed.

https://chatgpt.com/share/6985e838-488c-800f-8786-3269e587c14c
2026-02-06 14:10:03 +01:00
kevinveenbirkenbach 48237d758c Rename nginx_paths lookup to nginx and update all references
* Rename lookup plugin: lookup_plugins/nginx_paths.py -> lookup_plugins/nginx.py
* Update lookup usage from lookup('nginx_paths', ...) to lookup('nginx', ...) across roles/templates/vars
* Update unit tests accordingly (imports + patch targets)

https://chatgpt.com/share/6985e705-4040-800f-a779-347f06e46f82
2026-02-06 14:05:04 +01:00
kevinveenbirkenbach 3bb8c0ce30 refactor(tls): rename tls_resolve lookup to tls
The TLS lookup has been renamed from `tls_resolve` to `tls` to better
reflect its responsibility as a strict TLS state resolver.

This refactor updates all usages across the codebase, including:
- lookup plugins and internal helpers
- roles, vars, tasks, and templates
- tests, stubs, and error messages
- documentation and changelog references

Behavior, lookup API, and semantics remain unchanged.

https://chatgpt.com/share/6985e635-5a94-800f-b794-937e566ee308
2026-02-06 14:01:32 +01:00
kevinveenbirkenbach 208e3788d2 refactor(web-app-desktop): switch docker_cards to positional want-path for tls_resolve
Update docker_cards lookup to use the strict positional want-path API when
calling tls_resolve. Adjust unit tests and test stubs accordingly, removing
legacy want= kwargs while keeping behavior unchanged.

https://chatgpt.com/share/6985d642-b40c-800f-9cdf-ed54fc484a92
2026-02-06 13:48:13 +01:00
kevinveenbirkenbach 228ed1db0e refactor(database lookup): enforce strict positional want-path and drop want= kwarg
- Switch database lookup to strict positional want-path API
- Reject legacy want= keyword usage with hard error
- Update unit tests to cover strict term validation and projections

https://chatgpt.com/share/6985d642-b40c-800f-9cdf-ed54fc484a92
2026-02-06 13:14:13 +01:00
kevinveenbirkenbach b487134028 nginx_paths: restore cache directories and update unit tests for strict want-path API
Reintroduce directories.cache (general/image) in nginx_paths and use named
cache variables consistently in ensure. Update unit tests to validate cache
paths and projections under the new strict positional want-path API, and
adjust the tls_resolve fake to the new call style.

https://chatgpt.com/share/6985d642-b40c-800f-9cdf-ed54fc484a92
2026-02-06 13:01:36 +01:00
kevinveenbirkenbach fe04692f1f tests: switch tls_resolve and cert_plan unit tests to positional want-path
Update lookup calls to pass the want-path as the second positional term
(e.g. ["web-app-a", "files.cert"] / ["web-app-a", "url.base"]) and rename the
affected test methods accordingly.

https://chatgpt.com/share/6985d337-0c44-800f-9d79-d0922077abe0
2026-02-06 12:44:30 +01:00
kevinveenbirkenbach e1e1f3eb11 chore(vars): rename PATH_* to DIR_/BIN_/FILE_ conventions
https://chatgpt.com/share/6985cf49-3c74-800f-af97-f68b1969ab01
2026-02-06 12:23:46 +01:00
kevinveenbirkenbach 0cb620ef54 Revert "Removed unused run.py"
This reverts commit a9ac29c0c9.

It is used by CSP healthcheck. Additional:

refactor container execution to container wrapper and add unit tests

https://chatgpt.com/share/6985cba4-b410-800f-bedb-7e63d70fe4a6
2026-02-06 12:07:12 +01:00
kevinveenbirkenbach 1db08dbb79 Renamed DOCKER_COMPOSE to COMPOSE 2026-02-06 10:33:50 +01:00
kevinveenbirkenbach 7bb15d1b5e refactor(container): rename docker-container/docker services to sys-svc-container and update all references, schedules, tests, and templates
https://chatgpt.com/share/6985b09d-8ff8-800f-800c-7a694c0983e2
2026-02-06 10:12:31 +01:00
kevinveenbirkenbach 51239968fd refactor: rename docker-compose roles to sys-svc-compose and update paths
Renamed docker-compose and docker-compose-ca roles to sys-svc-compose and sys-svc-compose-ca, updated template includes, handlers, lookups, tests, and variables, and moved compose instances to /opt/compose.

https://chatgpt.com/share/6985ab2c-8344-800f-9e9a-768f562d138d
2026-02-06 09:49:42 +01:00
kevinveenbirkenbach a9ac29c0c9 Removed unused run.py 2026-02-06 09:10:01 +01:00
kevinveenbirkenbach 2d64920444 Removed comments 2026-02-05 20:45:23 +01:00
kevinveenbirkenbach 92182f6f8b refactor(docker-compose): migrate compose_ca_inject_cmd to docker lookup and update tests
- Remove dependency on docker_compose variable in compose_ca_inject_cmd lookup
- Resolve compose paths via lookup('docker', ...) consistently
- Simplify lookup by dropping YAML coercion and templating helpers
- Add dedicated unit tests under tests/unit/roles/docker-compose/lookup_plugins
- Update tests to reflect new lookup contract and CA_TRUST validation

https://chatgpt.com/share/6984f2e7-8390-800f-ac7b-938adc3738e3
2026-02-05 20:43:08 +01:00
kevinveenbirkenbach 3f08b77aa5 refactor(lookup): build compose_f_args paths via get_docker_paths, drop docker_compose var
- compose_f_args no longer reads variables['docker_compose']
- always derives compose file paths from PATH_DOCKER_COMPOSE_INSTANCES via get_docker_paths
- remove YAML coercion and related code paths
- update unit tests to stub get_docker_paths and assert new failure modes

https://chatgpt.com/share/6984dbd9-ce9c-800f-a2c9-72138193f383
2026-02-05 19:05:09 +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 25f7aab975 lookup(docker): slim API to dotted-path access only + adjust tests
- Simplify docker lookup to accept only application_id and optional dotted path
- Remove env fallback and explicit base path arguments
- Enforce dotted notation for sub-value access (e.g. directories.instance)
- Fail fast on missing PATH_DOCKER_COMPOSE_INSTANCES
- Update unit tests to reflect strict dotted-path behavior

https://chatgpt.com/share/6984ccea-8290-800f-a6d7-ec0e94df95a0
2026-02-05 18:38:25 +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 5fb188ad9c lookup(docker): add docker paths lookup with env fallback and unit tests
- Introduce lookup plugin `docker` to resolve docker-compose paths
  from application_id with PATH_DOCKER_COMPOSE_INSTANCES fallback
  (Ansible vars preferred, environment as fallback)
- Validate and strip inputs for deterministic behavior
- Return resolved paths as a single-item wantlist for safe templating
- Add comprehensive unittest coverage for precedence, validation,
  and fallback logic

https://chatgpt.com/share/6984ccea-8290-800f-a6d7-ec0e94df95a0
2026-02-05 18:01:21 +01:00
kevinveenbirkenbach b82eb632b2 docker-compose: remove compose_run wrapper and call compose.py directly
- Drop compose_run.py and its unit tests
- Call compose.py directly from handlers for `up`
- Restore explicit --force-recreate and --remove-orphans semantics
- Reduce wrapper indirection and hidden behavior
- Make docker compose execution transparent and deterministic

https://chatgpt.com/share/698496f7-7da0-800f-b030-5a90f741a9a6
2026-02-05 14:11:10 +01:00
kevinveenbirkenbach e194981535 refactor(backup): make database seeding strict and explicit
- enforce explicit database parameters for baudolo seeding
- replace implicit checks with assert-based fail-fast logic
- update rdbms, matrix and bigbluebutton roles to pass all db fields
- keep backup behavior unchanged while hardening configuration

https://chatgpt.com/share/6983c9e4-860c-800f-b0f7-28462c08e249
2026-02-04 23:36:08 +01:00
kevinveenbirkenbach 4b7200b451 lookup(database): add stable db role id and switch consumers to use it
- Extend database lookup with `id` (e.g. svc-db-postgres, svc-db-mariadb)
- Return empty id when no database type is configured
- Replace dynamic 'svc-db-{{ type }}' constructions with lookup-provided id
- Update docker network templates to rely on lookup database id
- Adjust sys-svc-rdbms to load DB role via lookup id
- Extend unit tests to assert correct id behavior for all cases

This makes DB role resolution explicit, safer, and less error-prone.

https://chatgpt.com/share/6983c6de-c5f8-800f-a5e3-786f90e0ebc1
2026-02-04 23:23:03 +01:00
kevinveenbirkenbach bd3f838188 lookup(database): add enabled/shared flags and extend unit tests
Expose database.enabled and database.shared via the database lookup plugin.
Use shared flag consistently to determine central DB behavior and surface both
flags even when no database type is configured. Update unit tests to cover the
new fields and verify behavior for dedicated vs. shared databases.

https://chatgpt.com/share/6983bcf6-85bc-800f-a0fc-5684b9078469
2026-02-04 22:40:54 +01:00
kevinveenbirkenbach 24616b2d35 refactor: extract get_docker_paths to module_utils and fix affected tests
- Move get_docker_paths() implementation from filter_plugins to module_utils
  to make it reusable by filters and lookup plugins (single source of truth)
- Adapt filter_plugins/get_docker_paths.py to re-export the shared util
- Add new lookup plugin "database" resolving DB settings from applications config
- Fix unit test patching: patch module_utils.docker_paths_utils.get_entity_name
  instead of filter module, because imports are now bound at util level
- Add comprehensive unit tests for database lookup covering all helper-variable cases

https://chatgpt.com/share/6983b526-00dc-800f-b3a0-b71e4104d0fc
2026-02-04 22:07:42 +01:00
kevinveenbirkenbach 8a81630391 Added newline at file and POSIX compatible 2026-02-04 19:49:56 +01:00
kevinveenbirkenbach 3e8abe3cb4 fix(rdbms): preserve database_consumer_id across role boundaries
- Introduce database_consumer_id_passed to avoid fact/vars collisions
- Explicitly pass consumer context into svc-db-postgres via include_role
- Strengthen context assertion in postgres init tasks
- Move once-flag include to the beginning of postgres core tasks
- Make POSTGRES_EXEC_SHELL non-interactive by injecting PGPASSWORD
- Improve test coverage to detect facts overridden by include-time vars

https://chatgpt.com/share/69833e56-93a0-800f-8e3d-d970cf87daef
2026-02-04 13:40:44 +01:00
kevinveenbirkenbach 8907b6c910 tests(integration): prevent overriding set_fact variables via include vars
Add an integration test that statically scans all Ansible task files under
roles/*/tasks/** and tasks/** and fails if a variable set via set_fact is
also passed via vars: on include/import tasks or roles.

This guards against scope leaks and accidental host-fact overrides caused
by mixing context variables with set_fact.

https://chatgpt.com/share/6983220c-29f4-800f-bb9b-5145b1c1cf75
2026-02-04 11:40:06 +01:00
kevinveenbirkenbach f1b5d2b764 Ruff 2026-02-03 20:21:58 +01:00
kevinveenbirkenbach 9a84fafec5 feat(inventory): add mirror_policy to control mirror image overrides
- Default policy (if_missing): manual image/version win, mirror fills blanks only
- Add mirror_policy=force to always overwrite image/version
- Add mirror_policy=skip to ignore mirror completely
- Treat empty/whitespace values as missing
- Preserve non-image/version service keys
- Extend unit tests to cover all mirror policy scenarios

https://chatgpt.com/share/6981036a-7e40-800f-b43e-13c66cc55fac
2026-02-02 21:04:53 +01:00
kevinveenbirkenbach db8107a933 Removed deprecated test_deprecated_version_key 2026-02-02 20:12:05 +01:00
kevinveenbirkenbach a70a033864 feat(inventory): add --mirror support to override docker images from mirrors file
- add --mirror flag to inventory creator
- resolve mirrors.yml automatically or via explicit path
- apply mirror overrides to applications.*.docker.services.* (image/version only)
- keep existing host_vars keys untouched
- add unit tests for mirror override behavior

https://chatgpt.com/share/6980cdb1-1e5c-800f-b25f-a1af757e4239
2026-02-02 17:15:30 +01:00
kevinveenbirkenbach 5e5a960bd8 test(integration): validate docker.services image/version syntax in role configs
Add a unittest-based integration test that scans all roles/*/config/main.yml
and validates docker.services.*.image and *.version only when present.
Ensures allowed Docker image name and tag characters without enforcing
image/version coupling.

https://chatgpt.com/share/6980cd2d-0644-800f-9e1f-0c8daa98e85c
2026-02-02 17:13:18 +01:00
kevinveenbirkenbach 76c614541f refactor(funkwhale): drop get_docker_image filter and switch to service-based image config
- Remove deprecated get_docker_image filter plugin and its unit tests
- Restructure Funkwhale docker config to use docker.services.<name>.image/version
- Introduce explicit FUNKWHALE_*_IMAGE and *_VERSION vars for clarity
- Update docker-compose template to use explicit image:version variables
- Align Funkwhale role with unified service-based Docker config model
2026-02-02 00:58:43 +01:00
kevinveenbirkenbach 6953e502ee fix(docker-compose-ca): escape $ vars in generated override commands
Prevent host-side Docker Compose interpolation from turning `$VAR` into an empty string by replacing `$` with `$$` in injected command argv, avoiding `exec ""` crashes; add unit tests for escaping behavior.

https://chatgpt.com/share/697f5e84-dea8-800f-b09e-58b3496250f3
2026-02-01 15:08:53 +01:00
kevinveenbirkenbach 7eb33408f3 fix(docker-compose-ca): support distroless images in CA override generator
https://chatgpt.com/share/697f2b57-7768-800f-a135-b9b7ee3ba474
2026-02-01 11:30:40 +01:00
kevinveenbirkenbach 18c971b7b0 fix(docker-compose-ca): build shared local images when referenced by non-build services
https://chatgpt.com/share/697e9aaf-f894-800f-b3c9-bdbdf2ea0d87
2026-02-01 01:13:25 +01:00
kevinveenbirkenbach 7fc125ecd5 test(compose): enforce image or merge key when build template is used
- Add integration test ensuring docker-compose.yml.j2 services that include build.yml.j2
  also define an image tag or YAML merge (<<:) at the same level
- Fix false positives by allowing image inheritance via anchors
- Add explicit custom image variables for littlejs and roulette-wheel services
- Minor formatting cleanup

https://chatgpt.com/share/697e8c69-0298-800f-ab25-2f650d6e7df9
2026-02-01 00:12:33 +01:00
kevinveenbirkenbach 5748fd30eb fix(sys-svc-docker): pull missing images before entrypoint inspect
https://chatgpt.com/share/697e893f-ab5c-800f-94de-52392369033e
2026-01-31 23:59:03 +01:00
kevinveenbirkenbach b3e8626632 docker-compose: make --chdir/--project optional; add wrapper unit tests
- Default --chdir to cwd when omitted
- Default --project to basename of chdir when omitted
- Resolve chdir path for stable behavior
- Add unit tests covering defaults, overrides, and passthrough "--" handling
- Rename test file to test_compose.py

https://chatgpt.com/share/697e35a5-14c8-800f-a00a-24c9d22a68a7
2026-01-31 18:02:19 +01:00
kevinveenbirkenbach 76d09dbc3f refactor: centralize docker wrappers, CA injection paths, and update tests
Unify compose/run wrappers under PATH_* variables, wire CA trust injection
consistently, extend with NSS/Chromium support, and adapt unit tests to the
new run-based execution model.

https://chatgpt.com/share/697e1f92-bc5c-800f-968d-ad43c50afaea
2026-01-31 17:06:09 +01:00
kevinveenbirkenbach aef99bf64e test(nginx_paths): mock tls_resolve lookup for protocol resolution
https://chatgpt.com/share/697ddc45-893c-800f-9c6d-ee899e4851cc
2026-01-31 11:40:21 +01:00
kevinveenbirkenbach ea8fbbdd71 fix(tls): resolve domains via app canonicals/aliases
- add module_utils/domain_mapper to map domains (canonical/aliases) -> application_id
  supporting str/list/dict and nested structures
- extend tls_common.resolve_term to optionally resolve alias domains via applications
  while keeping legacy lookup via global domains mapping intact
- pass applications into tls_resolve and cert_plan
- add unit tests for domain_mapper

https://chatgpt.com/share/697d500f-b884-800f-ba5b-088a2340f9d6
2026-01-31 01:42:43 +01:00
kevinveenbirkenbach c24b1044ae fix(domains): respect AUTO_BUILD_ALIASES when generating redirect mappings
- Do not auto-generate default alias (<entity>.<primary>) when AUTO_BUILD_ALIASES is false
- Only use explicitly defined aliases unless auto-build is enabled
- Treat empty server.domains as opt-out when auto-build is disabled
- Update unit tests to reflect strict alias semantics
- Clarify behavior with inline documentation and comments

https://chatgpt.com/share/697d4994-7690-800f-8987-296ce7215559
2026-01-31 01:15:11 +01:00
kevinveenbirkenbach 82e2cde747 refactor(nginx): replace NGINX vars with nginx_paths lookup and add http/https support
- Drop legacy NGINX path definitions from group_vars
- Add nginx_paths lookup plugin (paths + ensure dirs + http_includes)
- Update roles/templates to use nginx_paths for config/data/cache/user paths
- Add per-domain HTTP->HTTPS redirect + ACME challenge include
- Add unit tests for nginx_paths lookup
- Clean up obsolete sys-svc-letsencrypt role files

https://chatgpt.com/share/697d4466-af54-800f-a243-b28367638c85
2026-01-31 00:52:42 +01:00
kevinveenbirkenbach 3921306f11 fix(docker-compose): only pass --env-file to CA inject when file exists
The compose_ca_inject_cmd lookup previously appended --env-file
whenever docker_compose.files.env was set, even if the file did not
exist. This caused compose_ca_inject.py to fail hard.

Changes:
- Add existence check for env file using pathlib.Path.is_file()
- Resolve relative env paths against the compose instance directory
- Mirror existing handler behavior for --env-file handling
- Extend unit tests to cover both present and missing env-file cases
- Keep existing test coverage intact while adapting expectations

This aligns CA injection behavior with all other docker-compose handlers.

https://chatgpt.com/share/697d22a2-53c4-800f-9663-19a04f0587f6
2026-01-30 22:28:53 +01:00
kevinveenbirkenbach 2e7e31ba05 refactor: rename infinito-compose to compose-base and fix wrapper usage in cert deploy
- Rename infinito-compose wrapper to compose-base across roles and tests
- Introduce DOCKER_CMD_BASE as global base command configuration
- Update sys-ctl-mtn-cert-deploy to use compose_cmd consistently
- Fix compose wrapper argument parsing by enforcing "--" passthrough
- Harden project name resolution for trailing-slash instance paths
- Align docker restart helper scripts with compose-base naming
- Update unit tests to reflect renamed wrapper and new paths

https://chatgpt.com/share/697cf057-bd04-800f-9117-c007088f7fb8
2026-01-30 18:54:22 +01:00
kevinveenbirkenbach 2678090934 feat(ca-trust): unify trust injection + strict templating
Move `with-ca-trust.sh` to `sys-ca-selfsigned` as the single source of truth, add `CA_TRUST_NAME`/`trust_name`, and pass it through `compose_ca_inject.py` + `compose_ca_inject_cmd`. Introduce `module_utils/templating.py` for strict multi-pass rendering with fallback env lookup, update TLS self-signed regen logic, purge script, and extend unit tests accordingly.

https://chatgpt.com/share/697c876d-7140-800f-9981-762dfeeafdfe
2026-01-30 11:26:46 +01:00