LOGBOOK

HELP

Quiz Entry - updated: 2026.10.30

What is the difference between the YAML block scalars | and >?

| (literal block) keeps every line break; > (folded block) joins the lines into one, turning line breaks into spaces.

literal: |
  Line 1 stays
  Line 2 stays
  Line 3 stays
folded: >
  This is a folded
  multi-line text that
  becomes a single line.

literal contains three lines; folded contains the single line "This is a folded multi-line text that becomes a single line." (both end with one newline by default).

When to use which:

  • | when line breaks are meaningful: the contents of a config file or script you write with copy: content:, a certificate, a multi-line shell snippet.
  • > when you only want to wrap a long value over several lines for readability: a long description, a long command line.

The indented block underneath belongs to the key; it ends where the indentation returns to the key's level.

Go deeper:

From Quiz: ITIA / Ansible Inventory, Configuration and Playbooks | Updated: Oct 30, 2026