Pcornel
Automation · Data Formats › YAML

Sequences

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

Back to the Topic

Answer

YAML sequences are lists, written with a dash per item or inline as [a, b]. They correspond to JSON arrays, such as a list of hosts or tasks.

Remember

  • Sequences are lists with a dash per item.
  • Inline form [a, b] also works.
  • Indentation must be consistent.

First checks

  • yq '.items | length' file.yaml — sequence length
  • yq '.items[0]' file.yaml — element
  • Block (-) vs flow ([ ]) style — readability

Verify in this order

  • item → sequence

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

Confirmation

Confirm action

Continue?