Member-only story

Break a string over multiple lines — Ansible”>” and “|” operators

How to use multi-line YAML variables in Ansible using the “|”, Literal Block Scalar, and the “>”, Folded Block Scalar, operators. Plus how to elide the new line “\n” at the end of the line and print multi-line with debug module on a terminal.

Luca Berton
5 min readJan 18, 2022

How to Break a string over multiple lines with Ansible? And in general with YAML language.
I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible Break a string over multiple lines

  • “|” — Literal Block Scalar operator
  • “>” — Folded Block Scalar operator

Today we’re talking about Ansible Break a string over multiple lines:
Basically, there are two different operators:

  • the “|” — Literal Block Scalar”
  • the “>” Folded Block Scalar”

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

Responses (1)