Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

YAML

Direct answer

YAML is a human-friendly data format based on indentation, used for Ansible playbooks, Kubernetes manifests, CI pipelines and Compose files. Indentation and type guessing are frequent sources of errors.

When to use this

Use this when writing YAML for Ansible, Kubernetes or CI.

First 30 seconds

1. YAML: human-friendly superset of JSON with indentation.

2. Spaces only, consistent indentation.

3. Implicit typing pitfalls (yes/no, 0123, 1.10).

4. Quote ambiguous strings.

5. Lint in CI.

Operational verification

YAML text → safe parser → data

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
YAML 1.2 data representation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformYAML 1.2 data representation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when writing YAML for Ansible, Kubernetes or CI.
What next?3 suggested next steps
Child topics (this level)5
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Effective-state and workload closure Verify boundary

Local intent: YAML reference under Data Formats in the Automation Domain.

Step 2 Verification path Verify boundary

The negative fixture should deliberately exercise risks such as encoding/BOM issues, delimiter/quoting ambiguity, duplicate keys, namespace drift, scalar coercion, invalid schema assumptions and parser success without consumer-valid semantics, choosing the cases most relevant to YAML node types, tags, anchors/aliases, scalar resolution and consumer schema; parsing alone does not show the values have intended types.

Step 3 Branching troubleshooting Narrow the fault

Path: Automation → Data Formats → YAML. Local intent: YAML reference under Data Formats in the Automation Domain.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Drill down

Subtopics

Go one level deeper into this subject.

Key points
  • YAML uses indentation with spaces, never tabs.
  • Unquoted yes, no, on and 1.10 change type.
  • Lint before use.
Key checks
  • yamllint file.yaml — lint
  • yq '.' file.yaml — parse
  • python3 -c 'import yaml;yaml.safe_load(open("f.yaml"))' — safe load
ReferenceWhy it matters1 section · depth on demand

Internals and state

Local intent: YAML reference under Data Formats in the Automation Domain.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

YAML is a human-friendly data format based on indentation. It expresses the same structures as JSON — mappings, lists, scalars — with less punctuation, which is why Ansible, Kubernetes, CI pipelines and many configuration files use it.

device: sw-oslo-07
vlans:
  - id: 10
    name: MGMT
  - id: 20
    name: USERS
uplink: { interface: Te1/1/1, enabled: true }

YAML is a superset of JSON, so valid JSON is valid YAML. Its convenience comes with traps — indentation errors, implicit typing, tabs not allowed — so lint YAML files in CI (yamllint) and keep files consistently formatted.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docYAML 1.2 data representation current

Authoritative/upstream documentation reviewed for bounded claims in Data Formats > YAML. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://yaml.org/spec/1.2.2/ · confidence 94%
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

For YAML node types, tags, anchors/aliases, scalar resolution and consumer schema; parsing alone does not show the values have intended types, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?