On Tue, 31 Dec 2019 00:34:57 -0800 (PST)
Karther <
ryadmo...@gmail.com> wrote:
> No I have this result with this task :
> "msg": "exactly as you see\nwill appear these three\nlines of poetry\n"
>
> Le jeudi 12 décembre 2019 22:48:49 UTC+1, j1f0x a écrit :
> > maybe you try this:
> > include_newlines: |
> > exactly as you see
> > will appear these three
> > lines of poetry
The playbook below is self-explaining
- hosts: localhost
vars:
msg: |
exactly as you see
will appear these three
lines of poetry
tasks:
- debug:
msg: "{{ msg }}"
- debug:
msg: "{{ msg.split('\n') }}"
- debug:
msg: "{{ msg.split('\n')[:-1] }}"
gives
ok: [localhost] => {
"msg": "exactly as you see\nwill appear these three\nlines of poetry\n"
}
ok: [localhost] => { "msg": [
"exactly as you see",
"will appear these three",
"lines of poetry",
""
]
}
ok: [localhost] => { "msg": [
"exactly as you see",
"will appear these three",
"lines of poetry"
]
}
HTH,
-vlado