Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Ansible tips & tricks | ||||||||
Line: 22 to 22 | ||||||||
Use a backslash (\) to split long lines: | ||||||||
Changed: | ||||||||
< < | - fail: | |||||||
> > | - set_fact: | |||||||
msg: "This is the first part and second part of the string" | ||||||||
Added: | ||||||||
> > | - debug: var: msg | |||||||
Results in: | ||||||||
Deleted: | ||||||||
< < | fatal: [localhost]: FAILED! => {"changed": false, "msg": "This is the first part and second part of the string"} | |||||||
Changed: | ||||||||
< < | For other ways of splitting long lines, see: https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines | |||||||
> > | "msg": "This is the first part and second part of the string"
Use a greater-than sign (>) to split long lines, without interior line breaks:
- set_fact: msg: > This is the first part and second part of the string - debug: var: msgResults in: "msg": "This is the first part and second part of the string\n" Use a pipe sign (|) to split long lines, preserving interior line breaks: - set_fact: msg: | This is the first part and second part of the string - debug: var: msgResults in: "msg": "This is the first part \nand second part of the string\n" Add a minus sign (-) after a greater-than or pipe symbol to remove the line break at the end of the line (use >- or |-) See: https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines | |||||||
Dump all variables |