Adding a Solution
A solution is an external repository that contributes one layer of components to the
stack. The ai-solutions repo owns infrastructure, platform and inference; anything
above that lives in its own repo and is cloned into ext/ on demand.
This is the complete reference for wiring one up - the layer manifest, the component registry, roles, config, flavours, and how to verify it. It is the source of truth for these file formats; the YAML files themselves are kept comment-light and point back here.
What you have to create
| # | Where | File | Purpose |
|---|---|---|---|
| 1 | ai-solutions | configs/repos/repos.<layer>.yaml | which repos the layer needs, and at which rev |
| 2 | your repo | <subdir>/components.yaml | declares the layer + its components |
| 3 | your repo | <subdir>/roles/<component>/ | one role per component |
| 4 | your repo | <subdir>/config.yaml | operator-editable defaults, seeded on init |
| 5 | your repo | <subdir>/<config_dir>/<flavour>/config.yaml | optional presets |
| 6 | your repo | any path | optional models.yaml catalog |
<subdir> is whatever you set as deployment_subdir - "" when the Ansible tree sits at
the repo root, "deployment" when it's nested.
Exactly one change lands in ai-solutions: file 1. Everything else lives in your repo.
1. The layer manifest (in ai-solutions)
configs/repos/repos.<layer>.yaml. The filename carries the layer name - init mylayer
and install mylayer resolve to this file.
---
repos:
# Dependencies first: repos are cloned and configs seeded in file order.
- layer: "inference"
url: "https://github.com/<org>/<inference-repo>"
dest: "enterprise.ai-inference"
rev: "main"
deployment_subdir: ""
config_dir: ""
default_flavour: ""
model_catalog: "model_manager/models.yaml"
- layer: "mylayer" # primary layer - matches the filename
url: "https://github.com/<org>/<my-repo>"
dest: "my-solution" # → ext/my-solution/
rev: "main"
deployment_subdir: "deployment"
config_dir: "pipelines"
default_flavour: "chatqna"
| Field | Required | Meaning |
|---|---|---|
layer | yes | Layer this repo provides. Names the seeded config.<layer>.yaml. The entry matching the filename is the primary layer - the one --flavour applies to. |
url | yes | Git remote to clone. |
dest | yes | Directory created under ext/. |
rev | no (main) | Branch, tag, commit SHA, or a full ref such as refs/pull/N/head. A branch is checked out as a branch; anything else detaches. |
deployment_subdir | no ("") | Path to the dir holding roles/, components.yaml, config.yaml. |
config_dir | no ("") | Relative to deployment_subdir; holds one subdir per flavour. Empty → seed from config.yaml directly. |
default_flavour | no ("") | Flavour used when --flavour is omitted. |
model_catalog | no | Path from the repo root (not from deployment_subdir) to a models.yaml seeded into the env. |
A manifest is self-contained. List every repo the layer needs, including its
dependencies, each pinned separately. That keeps versions correlated per layer: a layer is
installed from exactly one manifest, so rev: there is that repo's version for that
layer. Listing the same repo in two manifests at different revs is supported and
deliberate.
Order matters - dependencies before the layer that needs them. Clone order, config-seed order, and config precedence all follow file order.
A layer participates only in the envs that were inited for it. init records the layer in
env/<env>/.solutions.yaml, and that record - not the presence of a clone in ext/ - decides
which solutions an env includes. ext/ is per checkout and shared by every env, so a plan that
reaches a layer the record does not list is refused rather than silently narrowed: either
init <layer> --env <env>, or move the repo out of ext/.
ai-solutions' own layers need no manifest. init platform works because platform is
declared in ../../configs/components.yaml and every role ships in
this repo. A layer is nameable when either a manifest or the merged registry declares it.
2. Repo layout
my-solution/
└── deployment/ ← deployment_subdir
├── components.yaml ← declares the layer + components
├── config.yaml ← seeded to env/<env>/config.mylayer.yaml
├── pipelines/ ← config_dir (optional)
│ ├── chatqna/config.yaml
│ ├── docsum/config.yaml
│ ├── _shared/ skipped (leading underscore)
│ └── examples/ skipped
└── roles/
├── my_bootstrap/
└── my_api/
The installer appends ext/<dest>/<deployment_subdir>/roles to ANSIBLE_ROLES_PATH at
runtime, so roles are found by name with no path coupling - moving a role between repos is
just a mv.
3. components.yaml - the layer and its components
Preflight discovers every ext/**/components.yaml and merges it into the ai-solutions
registry.
---
layers:
- name: mylayer
enabled: true
depends_on: [platform, inference]
components:
- name: my_bootstrap
layer: mylayer
enabled: true
depends_on: []
- name: my_api
layer: mylayer
enabled: "{{ my_api_enabled | default(true) | bool }}"
depends_on: [my_bootstrap]
Layer fields
| Field | Required | Notes |
|---|---|---|
name | yes | Declare your layer here, not in ai-solutions. Unique across the merged registry. |
depends_on | yes (may be []) | Layer names. Everything in those layers runs before anything in yours. |
enabled | no | Kept for compatibility; a declared layer is part of the stack. |
Component fields
| Field | Required | Notes |
|---|---|---|
name | yes | Must equal roles/<name>/. Unique across the merged registry. |
layer | yes | Your layer, or an existing one you're extending. |
depends_on | yes (may be []) | Component names in the same layer only. |
enabled | no (default true) | true/false, or a Jinja expression rendering to one. |
teardown | no (default labels) | labels: delete what install labelled (see Ownership labels). role: run the role's teardown.yaml instead. both: delete by label, then run teardown.yaml, for components that also change hosts. |
teardown_tasks | no | With teardown: labels, a tasks file of the role that runs before the labelled objects are deleted, to take back what the component changed in other components' objects (its portal entry and path on the gateway). The role needs vars/<cluster_distribution>.yaml. |
used_by | no | Component names, any layer, for a component that exists only to serve them. It is installed only while one of them is enabled, and tearing them down takes it along, unless one outside that teardown is still enabled (preflight prints Kept: …). Names not in the registry are ignored. |
Rules that actually bite
Order comes from depends_on, never from file position. Layers run in dependency order,
then components within each layer. Where nothing forces an order, declaration order is
preserved - treat that as a tiebreaker, not a guarantee. If order matters, declare it.
Component depends_on is same-layer only. Cross-layer ordering is the layer graph's job.
A cross-layer component dependency is either redundant or silently ineffective:
# WRONG - reaching across layers from a component
- name: my_api
layer: mylayer
depends_on: [keycloak] # keycloak is in `platform`
# RIGHT - the layer carries the edge
layers:
- name: mylayer
depends_on: [platform]
enabled: is rendered at preflight, before any role's defaults/main.yaml is loaded, so
only global_config.yaml and the seeded config.<layer>.yaml variables exist at that
moment. Always supply | default(...) - an undefined variable aborts the whole run - and
end with | bool. Rendering yields the string "True"/"False", which the resolver
coerces; recognised true values are true, yes, on, 1 (case-insensitive), and missing
or null means enabled. Anything unrecognised is false.
Extending someone else's layer is fine: set layer: to theirs and do not add a
layers: entry for it. Your components merge into that layer and order among its existing
ones by depends_on.
Prefix your component names with a short solution tag. Names share one namespace with layers and with every other solution's components.
A dependency cycle warns and does not fail - the plan comes out in an arbitrary but deterministic order. Don't rely on it; fix the cycle.
4. Roles
One role per component, at <subdir>/roles/<component-name>/:
roles/<name>/
├── defaults/main.yaml public settings only; no platform logic
├── vars/ optional, both files or neither
│ ├── kubernetes.yaml private _<name>_* literal values
│ └── openshift.yaml
├── templates/ no cluster_distribution
└── tasks/
├── main.yaml the dispatcher below, the same in every role but for the name
├── install.yaml required; the same on both platforms
├── validate.yaml required
├── teardown.yaml required
└── <helpers>.yaml called from the files above
# roles/<name>/tasks/main.yaml - the entire dispatcher
---
- name: "<name> | dispatch | Assert supported action"
ansible.builtin.assert:
that: component_action | default('') in ['install', 'teardown', 'validate']
fail_msg: "<name>: unsupported component_action='{{ component_action | default('') }}'"
quiet: true
# Only in a role with vars/kubernetes.yaml and vars/openshift.yaml:
- name: "<name> | dispatch | Load {{ cluster_distribution }} values"
ansible.builtin.include_vars: "{{ role_path }}/vars/{{ cluster_distribution }}.yaml"
when: (role_path ~ '/vars/' ~ cluster_distribution ~ '.yaml') is file
- name: "<name> | dispatch | Include {{ component_action }}"
ansible.builtin.include_tasks:
file: "{{ component_action }}.yaml"
| File | Required | Contract |
|---|---|---|
tasks/install.yaml | yes | Idempotent - a second run with no config change reports zero changed. |
tasks/teardown.yaml | yes | Runs only with teardown: role or both. Removes what labels cannot: host changes, changes other than labels to objects that existed before. Succeeds when nothing is installed. |
tasks/validate.yaml | yes | Read-only; never mutates the cluster. |
vars/kubernetes.yaml, vars/openshift.yaml | no | Both or neither, with the same keys. Literal values, named _<name>_*: include_vars keeps them for the rest of the play. A role without them has no Load step in its dispatcher. |
defaults/main.yaml | yes | Every variable the role reads, flat-named, with a working default. |
meta/main.yaml | no | Do not use dependencies: - ordering comes from components.yaml. |
Platform differences. cluster_distribution (kubernetes | openshift) is detected once,
in preflight, and only the dispatcher and components.yaml read it. The tasks are the same on
both platforms: whatever differs is a value in vars/<platform>.yaml. A role that uses the
cluster's operator on OpenShift instead of installing one (cert-manager, CNPG, Keycloak, NFD) has a
boolean _<name>_from_olm there: true checks the marketplace operator and skips its install,
and teardown leaves it and its CRDs. Where the two stacks differ throughout (observability:
Helm charts, or instances of the OperatorHub operators) the shared steps stay in install.yaml
and the flag picks a helper, install_helm.yaml or install_olm.yaml. A component not used on OpenShift (istio, metallb,
velero) is gated off in components.yaml and its role has no OpenShift steps. What every role needs
is published once: gateway publish.yaml creates the OpenShift Routes.
Library roles, entered with tasks_from, have no dispatcher: their caller passes
vars_from: "{{ cluster_distribution }}.yaml". The rack-scale fabric_* roles are not moved
to this layout yet.
Infrastructure does not depend on the platform. The infrastructure layer (kubernetes,
storage and its backends custom_storage, nfs_storage, rook_ceph_storage,
netapp_trident_csi) has no vars/<platform>.yaml, and components.yaml does not gate it on
cluster_distribution. A BYO cluster (existing_kubernetes) decides what it does: kubernetes
skips provisioning. OpenShift is always BYO: preflight stops on OpenShift without
existing_kubernetes. storage/tasks/resolve.yaml maps the storage selector on OpenShift to the
cluster's default StorageClass (custom): the CSI driver behind it comes from the marketplace.
Conventions: FQCN always (kubernetes.core.k8s, not k8s); no raw kubectl / helm /
ssh shell-outs - use kubernetes.core.*; pin collection and Python versions. The one
sanctioned shell-out is the model-manager CLI (see
Using the platform). Variables
are flat (my_api_replicas), never nested dicts - config files are merged by Ansible
extra-vars precedence, so a nested dict from one file replaces the other's wholesale rather
than merging.
Roles receive component_action (install | teardown | validate) plus env_dir,
env_name and kubernetes_kubeconfig. Generated credentials belong in log_dir
(env/<env>/logs).
Ownership labels
Roles do not label anything themselves. Around every component, of every layer, the core's
ownership role labels each object the component created:
ai-solutions.intel.com/env: <env name>
ai-solutions.intel.com/layer: <layer>
ai-solutions.intel.com/component: <component>
Before the first component it records the UID of every object on the cluster. While the
component runs, a callback (callback_plugins/ownership_record.py) records what its own
tasks report:
- objects a
kubernetes.core.k8sork8s_json_patchtask returns; withno_log, the object named in the task'sdefinition(srcandtemplateare not read: the callback warns), - releases a
kubernetes.core.helmtask installs or upgrades, also one that failed, - objects a
commandorshelltask prints the waykubectldoes (deployment.apps/web created, alsoconfigured,unchanged,serverside-applied,labeled,annotated,patched), which coverskubectl,ocandmodel-manager, and the releasehelm install/upgradeprints, - objects the component declares in
ownership_declared(see below).
After the component, also one that failed, it labels the objects these name that
- were not there before, so they appeared while the component ran,
- have no
ownerReferences(their owner is labelled, and garbage collection removes them), - carry no component label yet.
Nothing else is labelled: an object another user, a CronJob or an operator creates while the installer runs is left alone, even in the same namespace.
Helm releases are labelled whole: when a task reported the release and its first release
secret (v1) is new, or one of its release secrets is already labelled for the component,
the release secrets, all objects of the release's manifest and hooks, all objects Helm
annotates with the release (meta.helm.sh/release-name) and the chart's new CRDs (crds/)
are labelled. A subchart's crds/ is not kept in the release, so its CRDs need an
ownership_declared entry (kube-prometheus-stack's are declared for observability in
configs/components.yaml). A release that was there before keeps its release secrets unlabelled too, so
teardown never deletes part of a release's history and leaves the release broken.
Labels a component adds to a Namespace or Node that was there before (a customer's
namespace that joins the mesh with istio.io/dataplane-mode, a node placement label) are
recorded, not labelled: the object gets the annotation
ai-solutions.intel.com/labels-before.<env>.<component>, with the value each key had before
(null: absent) and the value set. Only objects a task reported count; kinds are listed in
ownership_restore_resources. Teardown puts the old values back for the keys that still
hold the value set, and drops the annotation. A key someone changed since is left as it is.
A run that is killed (Ctrl-C, a lost session) never gets to label the component it was in.
The component is noted in the state file before it runs, and the next install or
teardown labels what its records name, as that component, before it records the cluster.
The objects that appeared while a component failed (a failure no rescue: in the role
handled) or was killed and that nothing named are
kept aside for it: when its next run reports one of them (as unchanged or an update), it
is labelled as new.
In an env no install labelled, teardown runs each component's own teardown.yaml, as with
ownership_enabled: false. An env installed before the labels and installed again since
is marked in the state file: its first install with labels finds no state file, and an
earlier install log in env/<env>/logs that ran a component (one that stopped in preflight
installed nothing and doesn't count). What it installed before carries no labels, so in
that env each component is torn down as teardown: both, by label and then by its role's
teardown.yaml, until that has run once; from then on it is torn down as its entry says.
An env installed from scratch (also with the infrastructure layer) has no earlier logs and
is torn down by label.
A discovery pass that cannot read an API group version (an aggregated API that is down, a transient error) leaves it out and notes the group in the state file: until a later pass reads it, none of its objects count as new, so an existing object a task updates there is not labelled.
Teardown first restores the recorded labels, then deletes env=<env>,component=<component> in this order: custom resources
first, while their operators still run; then webhooks and APIServices; namespaced objects
(Helm release secrets included); namespaces; cluster-scoped objects; CRDs last. It waits
for each step. If an object is still there after ownership_delete_timeout, it fails and
stops before the next step, which may hold the controller that clears the object's
finalizer. Run teardown again once the cause is fixed. Teardown also deletes the Secret
cert-manager writes for a labelled Certificate (spec.secretName, annotated with the
certificate's name), which has no owner reference. It never deletes PVCs that are not
labelled: those of a StatefulSet's volumeClaimTemplates are left to the chart and the
StatefulSet's persistentVolumeClaimRetentionPolicy, so data outlives a teardown and
reinstall.
What this means for a role:
Create, don't adopt. An object that existed before the component ran (a namespace the customer made, a ConfigMap the role patches) is never labelled, so it is never deleted. Labels added to an existing Namespace or Node are put back for you; revert any other change to it in
teardown.yamland setteardown: both, or in a smaller tasks file named byteardown_tasks(publishing on the gateway:gateway/unpublish.yaml).Don't recreate objects with
force: true(replace). The new object keeps its UID but loses the labels.Let the task report what it creates. Use
kubernetes.core.k8sorkubernetes.core.helm, or a command that printskubectl-style lines. Akubectlcommand with-o nameor--quietprints nothing the callback can read.Declare what a Job creates. An object created by a Job, a script in a pod or a controller the component starts is not in any task result. In a namespace the component created that is fine: it goes with the namespace. Elsewhere, list it in
ownership_declaredon the component's entry in yourcomponents.yaml(kind,namespace,name,labels, any of them); it is labelled only if it appeared while the component ran:yaml- name: app_keycloak_config layer: erag ownership_declared: - {kind: Secret, name: erag-credentials} # the configurator Job's kubectl apply
5. Config and flavours
<subdir>/config.yaml is copied to env/<env>/config.<layer>.yaml on init. That copy is
what operators edit; the file in your repo is only the seed. init never overwrites an
existing env file - it reports exists, skipping.
For presets, add a config_dir with one subdir per flavour, each holding its own
config.yaml. Flavours are auto-discovered from the directory listing; examples and any
name starting with _ or . are ignored (use _shared/ for common material). --flavour
applies only to the primary layer; passing it to a layer with no config_dir, or to an
ai-solutions layer with no manifest, is an error rather than a silent no-op.
Variable precedence at install
Later -e wins in Ansible. The installer builds them in this order:
- Base facts -
component_action,target,env_name,env_dir,_include_deps config.<layer>.yamlfor each layer in the manifest, in manifest order - dependencies first, so your layer's config wins over the configs of layers you build onenv/<env>/global_config.yamlenv/<env>/nodes.yaml(only when it has real content, not just comments)kubernetes_kubeconfig
So global_config.yaml overrides whatever your config.<layer>.yaml ships - the
operator's environment-wide settings win over your defaults. Put solution-specific defaults
in your config.yaml, and expect anything an operator sets globally to take precedence.
6. Model catalog (optional)
Set model_catalog: to a path from your repo root and init seeds it to
env/<env>/models.yaml - again only when absent. Only one repo per manifest should declare
one. Everything else your repo ships (image lists, compatibility matrices, version files) is
private to it; ai-solutions reads nothing else.
Seeding is first-writer-wins: when an env already has a models.yaml (seeded by another
layer), yours is skipped. To deploy a model from your layer, see
Using the platform.
7. Using the platform from your layer
Reuse what the platform runs instead of rebuilding it. The points that bite:
- Publish hosts through the core
gatewayrole (publish.yaml,unpublish.yaml), not your own listeners. The gateway is deny-by-default: a route without its own policy needs a Keycloak JWT, so a UI with its own login gets401until you exempt its route withroute_auth_exempt.yaml. Example:roles/langfusein enterprise-inference. - Call models in-cluster at
http://ai-gateway.envoy-gateway-system.svc/v1(OpenAI-compatible, no token). - Deploy a model you need with
{{ playbook_dir }}/../model-manager deploy <model> --label <owner>, settingES_ENV: "{{ env_dir | basename }}"(the wrapper otherwise prompts, and there is no tty). Skip it when the model is already served, and in teardown undeploy only what carries your label. Example:deployment/roles/app_inference_modelsin enterprise-rag.
8. Running it
./es_auto_installer.sh init mylayer # clone + seed env/local/
./es_auto_installer.sh init mylayer --flavour docsum # with a preset
./es_auto_installer.sh init mylayer --env prod # a different environment
./es_auto_installer.sh show # merged layers + components
./es_auto_installer.sh install mylayer # layer + every layer below it
./es_auto_installer.sh install my_api # component + its same-layer deps
./es_auto_installer.sh install my_api --only # exactly that component
./es_auto_installer.sh validate mylayer # read-only checks
./es_auto_installer.sh teardown mylayer # layer + everything above it
./es_auto_installer.sh status # what is installed
There is no all target - name the topmost layer you want and its closure follows.
init is the only command that clones; install treats a missing repo as fatal and tells
you which init to run. It clones with plain git, so a private or internal repo needs git
credentials on the host first (for example gh auth setup-git). Running init for your
layer in an env already inited for another layer adds yours alongside it; nothing already
seeded is overwritten. Install resolves downward (a target needs what it depends on),
teardown resolves upward (a target's dependants go first) and reverses the order.
install mylayer re-runs every layer below yours - idempotent, but slow; while iterating on
a running cluster, install my_api --only runs just that component.
Ansible flags go after --: install mylayer -- --check -vvv. Set ES_LOG_LEVEL=debug for
verbose output plus ansible -vvv, or trace to add bash xtrace. Per-run logs land in
env/<env>/logs/.
9. Verify before opening the PR
Warning
A new env has no kubeconfig.yaml, and install without --only treats that as "no
cluster": it runs Kubespray cluster.yml against the env's inventory. On a host that
already runs a cluster, point the new env at it first - set
existing_kubernetes: /path/to/kubeconfig in env/dev/global_config.yaml, or copy the
kubeconfig to env/dev/kubeconfig.yaml.
./es_auto_installer.sh init mylayer --env dev
./es_auto_installer.sh show # your layer + components appear?
./es_auto_installer.sh install mylayer -- --check # resolves and orders, applies nothing
./es_auto_installer.sh install mylayer
./es_auto_installer.sh validate mylayer
./es_auto_installer.sh install mylayer # second run: zero changed
./es_auto_installer.sh teardown mylayer
./es_auto_installer.sh teardown mylayer # second run: still succeeds
The --check run executes preflight, so it confirms the merge, the resolution and the
execution order before anything touches the cluster. Read the printed plan: it is the exact
order your components will run in.
10. Troubleshooting
| Symptom | Cause |
|---|---|
Unknown layer: 'mylayer' | No configs/repos/repos.mylayer.yaml, and the registry doesn't declare the layer either. |
Unknown target 'mylayer' from the resolver | The repo is cloned but its components.yaml doesn't declare the layer - check layers: isn't empty. |
Layer 'mylayer' needs ext/... but it is not cloned | Run init mylayer first; install never clones. |
Your layer/components missing from show | components.yaml isn't where deployment_subdir says, or it's malformed - show warns on a bad merge. |
'x' is undefined during preflight | An enabled: expression lacks ` |
| Role not found | Component name doesn't match the role directory, or roles/ isn't under deployment_subdir. |
| A component runs too early/late | Its depends_on is missing, or it names a component in another layer - put the edge on the layer instead. |
401 on your app's host from the gateway | The gateway is deny-by-default - exempt the route (see Using the platform). |
init fails with could not read Username for 'https://github.com' | The repo is private or internal and the host has no git credentials. |
install on a new env starts provisioning Kubernetes | The env has no kubeconfig.yaml - see the warning in Verify. |
| A component silently never runs | Its enabled: rendered to something falsey. show and the "Skipped (disabled)" preflight line list what was dropped. |
Resolution and ordering live in ../../filter_plugins/resolve_components.py, called from ../../playbooks/includes/preflight.yaml.