diff --git a/docs/administration/configuration/email.md b/docs/administration/configuration/email.md index ab701da6fc..3a64f0b49a 100644 --- a/docs/administration/configuration/email.md +++ b/docs/administration/configuration/email.md @@ -38,18 +38,16 @@ overridden from inventory by setting the matching `SYSTEM_EMAIL_` variable ## Per-Application Overrides 🧩 Applications MAY override any subset of these keys under -`compose.services.email` in their role or inventory. +`services.email` in their role or inventory. Role defaults: ```yaml -# roles//config/main.yml -compose: - services: - email: - host: smtp.app.example.org - port: 587 - tls: true +# roles//meta/services.yml +email: + host: smtp.app.example.org + port: 587 + tls: true ``` Inventory overrides: @@ -58,10 +56,9 @@ Inventory overrides: # group_vars/.yml or host_vars/.yml applications: web-app-nextcloud: - compose: - services: - email: - username: nextcloud@example.org + services: + email: + username: nextcloud@example.org ``` Overrides are merged on top of the resolved defaults. Keys MUST use the short, @@ -71,7 +68,7 @@ lowercased names listed above. For each key, the first defined source wins: -1. `applications[''].compose.services.email.`, applied +1. `applications[''].services.email.`, applied only when an `application_id` is passed. 2. A `SYSTEM_EMAIL_` variable defined in inventory, group vars, or host vars. No such file ships with the project. This form is an escape hatch for diff --git a/group_vars/all/TODO.md b/group_vars/all/TODO.md index ea15d085fc..a26ed0cd82 100644 --- a/group_vars/all/TODO.md +++ b/group_vars/all/TODO.md @@ -1,5 +1,5 @@ # Todos - Remove *_ports.yml and*_networks.yml by a lookup function -- Move their values to the roles/*/config/main.yml file of each role +- Move their values to the roles/*/meta/services.yml file of each role - Implement validators (e.g. no overlappsing networks, unique ports) for all of this configurations diff --git a/tests/integration/ansible/inventory/test_manager.py b/tests/integration/ansible/inventory/test_manager.py index 9447307c6a..13907006d7 100644 --- a/tests/integration/ansible/inventory/test_manager.py +++ b/tests/integration/ansible/inventory/test_manager.py @@ -177,7 +177,7 @@ class TestInventoryManagerIntegration(TestCase): def test_apply_schema_skips_schema_less_transitive_provider_role(self): """ - Shared provider roles without schema/main.yml must be ignored gracefully. + Shared provider roles without meta/secrets.yml must be ignored gracefully. This matters for roles like web-svc-asset that participate in dependency discovery but do not define credentials. """ diff --git a/tests/integration/infrastructure/services/README.md b/tests/integration/infrastructure/services/README.md index ff51df69ee..8783ee97c8 100644 --- a/tests/integration/infrastructure/services/README.md +++ b/tests/integration/infrastructure/services/README.md @@ -1,6 +1,6 @@ # Service Registry Tests 🛰️ -Integration tests that validate the service registry discovered from `roles/*/config/main.yml`: canonical aliases are consistent, every service key resolves via `plugins/lookup/service.py`, `sys-svc-*` roles carry a `system_service_id` matching their folder, and transitive dependencies (e.g. dashboard → mailu) are declared correctly. +Integration tests that validate the service registry discovered from `roles/*/meta/services.yml`: canonical aliases are consistent, every service key resolves via `plugins/lookup/service.py`, `sys-svc-*` roles carry a `system_service_id` matching their folder, and transitive dependencies (e.g. dashboard → mailu) are declared correctly. Tests in this directory MUST only cover service-registry semantics. Tests for `application_id` identity MUST live under `tests/integration/roles/applications/id/`, and generic role-structure rules MUST live under `tests/integration/roles/`. diff --git a/tests/integration/infrastructure/services/test_mailu_dependency.py b/tests/integration/infrastructure/services/test_mailu_dependency.py index 0f4d306d73..727a514ec5 100644 --- a/tests/integration/infrastructure/services/test_mailu_dependency.py +++ b/tests/integration/infrastructure/services/test_mailu_dependency.py @@ -75,7 +75,7 @@ def _scan_role(role_path: Path) -> tuple[bool, bool]: class TestMailuServiceDependency(unittest.TestCase): """Every role that references 'web-app-mailu' or calls lookup('email', ...) must declare services.email with enabled: true and shared: true - in its config/main.yml.""" + in its meta/services.yml.""" def setUp(self): self.roles_root = PROJECT_ROOT / "roles" diff --git a/tests/integration/roles/meta/server/test_csp_consistency.py b/tests/integration/roles/meta/server/test_csp_consistency.py index de091aee24..99d90fbbfd 100644 --- a/tests/integration/roles/meta/server/test_csp_consistency.py +++ b/tests/integration/roles/meta/server/test_csp_consistency.py @@ -12,7 +12,7 @@ from . import PROJECT_ROOT class TestCspConfigurationConsistency(unittest.TestCase): """ - Iterate all roles; for each config/main.yml that defines 'csp', + Iterate all roles; for each meta/services.yml that defines 'csp', assert consistent structure and values: - csp is a dict - whitelist/flags/hashes are dicts if present diff --git a/tests/integration/roles/meta/services/prometheus/test_role_wiring.py b/tests/integration/roles/meta/services/prometheus/test_role_wiring.py index 95a6ab1878..6d80e75e17 100644 --- a/tests/integration/roles/meta/services/prometheus/test_role_wiring.py +++ b/tests/integration/roles/meta/services/prometheus/test_role_wiring.py @@ -51,7 +51,7 @@ class TestPrometheusServicePresence(unittest.TestCase): def test_all_web_roles_have_prometheus_service(self): """Every web-app-* and web-svc-* role must have services.prometheus.""" configs = self._web_role_configs() - self.assertTrue(configs, "No web-app-*/web-svc-* config/main.yml files found") + self.assertTrue(configs, "No web-app-*/web-svc-* meta/services.yml files found") errors = [] for file_path in configs: @@ -130,7 +130,7 @@ class TestPrometheusServicePresence(unittest.TestCase): "prom/blackbox-exporter:latest", content, "compose.yml.j2 must not use :latest for blackbox-exporter — pin to a version " - "via config/main.yml (services.blackbox-exporter.version)", + "via meta/services.yml (services.blackbox-exporter.version)", ) self.assertIn( "lookup('container_image', application_id, 'blackbox-exporter')", diff --git a/tests/lint/ansible/roles/meta/test_layout.py b/tests/lint/ansible/roles/meta/test_layout.py index d00bf9c15e..0d4944b1ed 100644 --- a/tests/lint/ansible/roles/meta/test_layout.py +++ b/tests/lint/ansible/roles/meta/test_layout.py @@ -100,6 +100,8 @@ class TestNoLegacyPathReferences(unittest.TestCase): "cli", "roles", "scripts", + "tasks", + "tests", "filter_plugins", "lookup_plugins", ) @@ -113,7 +115,11 @@ class TestNoLegacyPathReferences(unittest.TestCase): ) EXEMPT_FILES: ClassVar[set[Path]] = { - PROJECT_ROOT / "tasks" / "utils" / "migrate_meta_layout.py", + Path(__file__).resolve(), + } + + EXEMPT_DIRS: ClassVar[set[Path]] = { + PROJECT_ROOT / "tasks" / "utils" / "migrate_meta_layout", } def test_no_legacy_path_strings(self): @@ -130,7 +136,9 @@ class TestNoLegacyPathReferences(unittest.TestCase): continue if any(frag in path_str for frag in self.SKIP_FRAGMENTS): continue - if path in self.EXEMPT_FILES: + if path in self.EXEMPT_FILES or any( + path.is_relative_to(exempt) for exempt in self.EXEMPT_DIRS + ): continue try: text = read_text(path_str) diff --git a/tests/lint/ansible/roles/web-app/integration/test_email.py b/tests/lint/ansible/roles/web-app/integration/test_email.py index 3e0b083338..c1014ec70b 100644 --- a/tests/lint/ansible/roles/web-app/integration/test_email.py +++ b/tests/lint/ansible/roles/web-app/integration/test_email.py @@ -108,7 +108,7 @@ class TestWebAppRolesIntegrateEmail(unittest.TestCase): * Roles that call ``lookup('email', ...)`` **must** declare ``services.email`` with ``enabled: true`` AND ``shared: true`` - in ``config/main.yml``. Missing declarations fail the test hard. + in ``meta/services.yml``. Missing declarations fail the test hard. * Roles that do **not** call ``lookup('email', ...)`` and have no explicit opt-out block emit a non-blocking warning annotation. """ diff --git a/tests/lint/repository/yaml/test_no_direct_calls.py b/tests/lint/repository/yaml/test_no_direct_calls.py index f8da5d1bce..da36afa305 100644 --- a/tests/lint/repository/yaml/test_no_direct_calls.py +++ b/tests/lint/repository/yaml/test_no_direct_calls.py @@ -19,7 +19,7 @@ Allowed ======= * ``utils/cache/yaml.py``: IS the cache, MUST call ``yaml.safe_load`` / ``yaml.safe_dump`` directly. -* ``tasks/utils/migrate_meta_layout.py``: migration script that +* ``tasks/utils/migrate_meta_layout/``: migration package that operates pre-migration on raw on-disk YAML; predates the cache by design. * Tests that legitimately need raw YAML access (e.g. writing synthetic diff --git a/tests/unit/python/cli/administration/inventory/provision/test_credentials_generator.py b/tests/unit/python/cli/administration/inventory/provision/test_credentials_generator.py index c6a101ff58..c0ecbccae0 100644 --- a/tests/unit/python/cli/administration/inventory/provision/test_credentials_generator.py +++ b/tests/unit/python/cli/administration/inventory/provision/test_credentials_generator.py @@ -84,7 +84,7 @@ ansible_become_password: !vault | def test_generate_credentials_does_not_fail_for_roles_without_schema(self): """ Schema-less roles may still be passed to cli.administration.inventory.credentials - because credentials generation can be driven transitively from config/main.yml. + because credentials generation can be driven transitively from meta/services.yml. The generator must not crash if the snippet is empty. """ with tempfile.TemporaryDirectory() as tmpdir: diff --git a/tests/unit/python/plugins/lookup/test_native_metrics_apps.py b/tests/unit/python/plugins/lookup/test_native_metrics_apps.py index 00ae9be327..9f08e43c77 100644 --- a/tests/unit/python/plugins/lookup/test_native_metrics_apps.py +++ b/tests/unit/python/plugins/lookup/test_native_metrics_apps.py @@ -49,7 +49,7 @@ def _run( def _make_roles(tmp: Path, specs: dict) -> dict: """Create minimal role fixtures under tmp/ and return an applications dict. - In real Ansible, role config/main.yml defaults are merged into the + In real Ansible, role meta/services.yml defaults are merged into the `applications` variable before any play runs. This helper replicates that by building both the filesystem structure (for fragment discovery) and the applications dict (for get_app_conf lookups) from the same spec.