mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
This should set the sender properly.
This commit is contained in:
parent
dfaef8061a
commit
de34c7c133
1 changed files with 2 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
||||||
def mail(subject='Ansible error mail', sender='root', to='root', cc=None, bcc=None, body=None):
|
def mail(subject='Ansible error mail', sender='<root>', to='root', cc=None, bcc=None, body=None):
|
||||||
if not body:
|
if not body:
|
||||||
body = subject
|
body = subject
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class CallbackModule(object):
|
||||||
def runner_on_failed(self, host, res, ignore_errors=False):
|
def runner_on_failed(self, host, res, ignore_errors=False):
|
||||||
if ignore_errors:
|
if ignore_errors:
|
||||||
return
|
return
|
||||||
sender = 'Ansible error on %s' % host
|
sender = 'Ansible error on %s <root>' % host
|
||||||
subject = 'Failure: %s' % res['msg'].split('\n')[0]
|
subject = 'Failure: %s' % res['msg'].split('\n')[0]
|
||||||
mail(sender=sender, subject=subject,
|
mail(sender=sender, subject=subject,
|
||||||
body='''The following task failed for host %s:
|
body='''The following task failed for host %s:
|
||||||
|
|
Loading…
Reference in a new issue