Re: [ansible-project] Mail Callback
Hi Martin Thanks for the swift response! Ah ok, I shall upgrade the Python Version in that case! I am currently running: ansible 2.5.5 Regards JS -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3a64cf21-542c-4b34-b22f-3c562dedcf59%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Mail Callback
On Fri, Sep 7, 2018 at 1:15 PM Martin Krizek wrote: > > The traceback you're getting says "unexpected keyword argument > 'flags'". That argument was added in Python 2.7 which is also the > minimal Python version supported by Ansible on the controller side. But that's being done for 2.7. What Ansible version are you running? -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CADDq2EP%2BXsDmEKQ72XQFujS1j12zPBD7xMW7MfP%2Brnoc63HL4w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Mail Callback
The traceback you're getting says "unexpected keyword argument 'flags'". That argument was added in Python 2.7 which is also the minimal Python version supported by Ansible on the controller side. M. -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CADDq2EMEYf%2By68%2Bv0TWfvE_wQ0_YLQEQFv9XH-XDqZEYRim-Pg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Mail Callback
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 = u...@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 (): 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 -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/be88bfc0-153b-4f8d-b22f-99a692e6abb5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Mail Callback With Items
Hi, I'm running Ansible 2.4.1.0. I have the below but for some reason I'm not getting the expected behaviour. Maybe I'm wrong or have assumed incorrectly? I'm expecting the mail callback plugin to output the fail msg. Please can someone suggest a change or workaround? Thank you. - name: check allowed ports tags: ports fail: msg: "Ansible: Alert - Rogue Port {{ item }}" with_items: "{{ ports_var.stdout_lines }}" failed_when: - "item not in ports_lookup_var" If I run by hand: ansible-playbook playbooks/rpc.yml --limit=warp.?.local --tags ports TASK [check allowed ports] * failed: [warp.?.local] (item=127.0.0.1:1196) => {"changed": false, "failed": true, "failed_when_result": true, "item": "127.0.0.1:1196", "msg": "Ansible: Alert - Rogue Port 127.0.0.1:1196"} ok: [warp.?.local] => (item=*:22) ok: [warp.?.local] => (item=127.0.0.1:25) ok: [warp.?.local] => (item=127.0.0.1:8090) to retry, use: --limit @/home/ansible/playbooks/rpc.retry PLAY RECAP * warp.gsoc.local: ok=1changed=1unreachable=0failed=1 The mail received: Date: Thu, 14 Dec 2017 18:40:36 +0200 (SAST) From: "Ansible: node03.??.local"To: root@ansible.??.local Subject: Failed: All items completed Playbook: rpc.yml Task: check allowed ports Module: fail Host: node03.???.local The following task failed: check allowed ports (fail) with the following message: All items completed A complete dump of the error: Failed: {"msg": "All items completed", "failed": true, "changed": false} -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/639eae0b-93c1-4bd1-9a26-819b7a7e1fb6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.