Pcornel
Automation · Data Formats › YAML

Mappings

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

Back to the Topic

Answer

YAML mappings are key-value pairs written key: value, nested by indentation with spaces, never tabs. They correspond to JSON objects and Python dictionaries.

Remember

  • Mappings are key: value pairs.
  • Nesting uses indentation with spaces.
  • Duplicate keys are errors or silently overwrite.

First checks

  • yq 'keys' file.yaml — mapping keys
  • yamllint -d '{rules: {key-duplicates: enable}}' file.yaml — duplicate keys
  • Indentation consistency — structure

Verify in this order

key: value → mapping

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=5825

Confirmation

Confirm action

Continue?