I am running ansible on a macbook pro. when i use mail Mod like this...
- name: Send Emails
local_action: mail
subject="Company WFI Report -- Automated email"
body="This email is automated contact Colin Mackenzie if you have problems"
from="
Colin.M...@company.com"
to="
Blah0...@company.com,
Blah1...@company.com,
Blah1...@company.com"
cc="
Colin.M...@company.com"
attach='/Users/mackc/ansible/reports/{{ inventory_hostname }}-WFIActiveViewers-{{ filename_date_part }}.txt'
charset=utf8
I get this error:
fatal: [WEBNODE1 -> localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"attach": "/Users/mackc/ansible/reports/WEBNODE1-WFIActiveViewers-20160602124241UTC.txt", "bcc": null, "body": "This email is automated contact Colin Mackenzie if you have problems", "cc": "
Colin.M...@company.com", "charset": "utf8", "from": "
Colin.M...@company.com", "headers": null, "host": "localhost", "password": null, "port": "25", "sender": "
blah...@company.com", "subject": Compnay WFI Report -- Automated email", "subtype": "plain", "to": "
Blah2...@company.com,
Blah1...@company.com,
Blah2...@company.com", "username": null}, "module_name": "mail"}, "msg": "Failed to send mail to server localhost on port 25: [Errno 61] Connection refused", "rc": 1}
I can send email fine from the command line like this:
uuencode /Users/mackc/ansible/reports/areport areport | mail -s "Company Report"
colin.m...@company.comWhat am i missing so i can send email from ansible playbook i have?
Thanks for anyone taking the time to respond.
-cm3