How can I add new line characters to Ansible variable mailbody. This
mailbody variable is used for mail module's body attribute.
I tried the below from suggestions but none of them works.
1.
- set_fact:
mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' + PROFILE_NAME ~
'\n\nSERVER_NAME:' + SERVER_NAME ~ '\n\nNODE_NAME:' + NODE_NAME ~ '\n\n\n\n'
}}"
2.
mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' + PROFILE_NAME
~}} {{ 'SERVER_NAME:' + SERVER_NAME ~ }}\n\n{{'NODE_NAME:' + NODE_NAME ~
}}\n\n\n\n"
3.
mailbody: |
"{{ mailbody | default('') + 'PROFILE_NAME:' + PROFILE_NAME ~}}"
"{{ 'SERVER_NAME:' + SERVER_NAME ~ }}"
"{{'NODE_NAME:' + NODE_NAME ~ }}"
In the mail body i see '\n' instead of the new line charecter.
Can you please suggest ?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c9a4818e-dab2-4ad8-8d6c-c477e8915193%40googlegroups.com.