Hello!
I am trying to receive email alerts anytime a playbook fails.
Could anyone guide me as to how I can configure / setup the mail callback feature to work?
I tried un-commenting the following line in ansible.cfg and added the following lines:
`
callback_whitelist = timer, mail (uncommented)
[callback_mail] (added)
to = user@example.com (added)
`
However, I got the following error when I ran the playbook:
[WARNING]: Failure using method (v2_runner_on_failed) in callback plugin (<ansible.plugins.callback.mail.CallbackModule object at
0x25c8e10>): sub() got an unexpected keyword argument ‘flags’
Callback Exception:
File “/usr/lib/python2.6/site-packages/ansible/executor/task_queue_manager.py”, line 374, in send_callback
method(*new_args, **kwargs)
File “/usr/lib/python2.6/site-packages/ansible/plugins/callback/mail.py”, line 220, in v2_runner_on_failed
self.mail_result(result, ‘Failed’)
File “/usr/lib/python2.6/site-packages/ansible/plugins/callback/mail.py”, line 182, in mail_result
body += self.indent(‘%s\n’ % result._task.action)
File “/usr/lib/python2.6/site-packages/ansible/plugins/callback/mail.py”, line 136, in indent
return re.sub(‘^’, ’ ’ * indent, multiline, flags=re.MULTILINE)
Any assistance will be much appreciated !
Regards
JS