I am quite new to YAML and cannot find the solution to this error. My main.yml is setting the ansible_host and actions variables and calling the mail.yml.
Mail.yml
- name: set variables
set_fact:
currentDateTime: "{{lookup('pipe','date \"+%Y-%m-%d %H:%M\"')}}
- name: send email
mail:
host: smtp.domain.com
port: 25
to: John Doe <john.doe@gmail.com>
from: {{ ansible_host }}@domain.com
subject: Please perform {{ actions }} on {{ currentDateTime }}
body: Run {{ ansible_host }}
There are no tabs (only spaces) and I have tried adding quotes "" to the values under mail but still getting the:
"Syntax error while loading YAML.\n found character that cannot start any token\n\nThe error appears to be in
'mail.yml': line 11, column 33. The offending line appears to be:\n\n to: John Doe <john.doe@gmail.com>."
Any assistance would be greatly appreciated.
Thanks.