Pcornel
Automation · Data Formats

YAML

Cheat sheet · https://pcornel.dk/topic.php?topic=5824

Back to the Topic

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.

Remember

  • YAML uses indentation with spaces, never tabs.
  • Unquoted yes, no, on and 1.10 change type.
  • Lint before use.

First checks

  • yamllint file.yaml — lint
  • yq '.' file.yaml — parse
  • python3 -c 'import yaml;yaml.safe_load(open("f.yaml"))' — safe load

Verify in this order

YAML text → safe parser → data

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5824

Confirmation

Confirm action

Continue?