[ansible-project] Re: Ansible Mail Module Failing

2018-11-06 Thread mrdatamapper
I add *secure: neve*r and now its work

 - name: mail send
mail:
  host: 127.0.0.1
  port: 25
  *secure**:** never*
  subject: "Hello"



вторник, 6 марта 2018 г., 23:09:52 UTC+8 пользователь Simon Hayes написал:
>
> I'm running a simple playbook to report on server configurations which is 
> formatted into an html file from a template.  I use the mail module to 
> attach the html file into the body of the mail as follows:
>
>
>
>
>
>
>
>
>
>
>
>
> *- hosts: localhost  tasks:- name: Send e-mail  local_action: 
> mailport=25headers="Content-type=text/html"
> subtype=htmlfrom="x...@xxx.com "
> to="x...@xxx.com "subject='Server Report'
> body="{{ lookup('file', '/tmp/report.html') }}"*
>
> When I run this on a group of 13/14 servers the play runs fine, mail is 
> sent and received as expected.  If I add more servers to the group, the 
> initial parts of the playbook run fine, but then it fails when attempting 
> to send the mail.  I've not seen this with any other playbooks or roles I 
> have on the same server, emails seem to send out just fine
>
>
>
> *TASK [Send e-mail] 
> ***An
>  
> exception occurred during task execution. To see the full traceback, use 
> -vvv. The error was: socket.error: [Errno 111] Connection refusedfatal: 
> [localhost -> localhost]: FAILED! => {"changed": false, "module_stderr": 
> "Traceback (most recent call last):\n  File 
> \"/tmp/ansible_TNdcry/ansible_module_mail.py\", line 386, in \n
> main()\n  File \"/tmp/ansible_TNdcry/ansible_module_mail.py\", line 257, in 
> main\ncode, smtpmessage = smtp.connect(host, port=port)\n  File 
> \"/usr/lib64/python2.6/smtplib.py\", line 300, in connect\nself.sock = 
> self._get_socket(host, port, self.timeout)\n  File 
> \"/usr/lib64/python2.6/smtplib.py\", line 278, in _get_socket\nreturn 
> socket.create_connection((port, host), timeout)\n  File 
> \"/usr/lib64/python2.6/socket.py\", line 567, in create_connection\n
> raise error, msg\nsocket.error: [Errno 111] Connection refused\n", 
> "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}*
>
> /var/log/messages shows the following abrtd errors which appear to come 
> from python and ansible_module_mail.py:
>
>
>
> *Mar  5 17:45:13  abrt: [ID - user.info 
> ]  detected unhandled Python exception in 
> '/tmp/ansible_TNdcry/ansible_module_mail.py'Mar  5 17:45:14 
>  abrtd: [ID - daemon.err]  Directory 
> 'pyhook-2018-03-05-17:45:14-17875' creation detectedMar  5 17:45:14 
>  abrt-server[18081]: [ID - daemon.err]  Saved Python 
> crash dump of pid 17875 to /var/spool/abrt/pyhook-2018-03-05-17:45:14-17875*
>
> What I don't know is whether this is ansible and/or python, or perhaps my 
> poor implementation of the mail module.  Google search has not returned any 
> worthy suggestions or causes.  Could I be missing something server side - 
> python config or sendmail?
> Does anyone have any ideas?
>
> Version information:
>
>  
>
>
>
>
> * ansible 2.4.3.0  config file = /etc/ansible/ansible.cfg  configured 
> module search path = [u'/root/.ansible/plugins/modules', 
> u'/usr/share/ansible/plugins/modules']  ansible python module location = 
> /usr/lib/python2.6/site-packages/ansible  executable location = 
> /usr/bin/ansible  python version = 2.6.6 (r266:84292, Aug  9 2016, 
> 06:11:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]*
>
> -Simon
>

-- 
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/18cfd594-fbb4-4769-8968-201ac4827832%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Mail Module Failing

2018-03-06 Thread rraka1002
@Simon, So whenyou run `ansible-playbook --syntax-check mail.yml`  does it 
gives some error code?
i tried that with ansible version 2.4 and it works as expected

On Tuesday, March 6, 2018 at 8:39:52 PM UTC+5:30, Simon Hayes wrote:
>
> I'm running a simple playbook to report on server configurations which is 
> formatted into an html file from a template.  I use the mail module to 
> attach the html file into the body of the mail as follows:
>
>
>
>
>
>
>
>
>
>
>
>
> *- hosts: localhost  tasks:- name: Send e-mail  local_action: 
> mailport=25headers="Content-type=text/html"
> subtype=htmlfrom="x...@xxx.com "
> to="x...@xxx.com "subject='Server Report'
> body="{{ lookup('file', '/tmp/report.html') }}"*
>
> When I run this on a group of 13/14 servers the play runs fine, mail is 
> sent and received as expected.  If I add more servers to the group, the 
> initial parts of the playbook run fine, but then it fails when attempting 
> to send the mail.  I've not seen this with any other playbooks or roles I 
> have on the same server, emails seem to send out just fine
>
>
>
> *TASK [Send e-mail] 
> ***An
>  
> exception occurred during task execution. To see the full traceback, use 
> -vvv. The error was: socket.error: [Errno 111] Connection refusedfatal: 
> [localhost -> localhost]: FAILED! => {"changed": false, "module_stderr": 
> "Traceback (most recent call last):\n  File 
> \"/tmp/ansible_TNdcry/ansible_module_mail.py\", line 386, in \n
> main()\n  File \"/tmp/ansible_TNdcry/ansible_module_mail.py\", line 257, in 
> main\ncode, smtpmessage = smtp.connect(host, port=port)\n  File 
> \"/usr/lib64/python2.6/smtplib.py\", line 300, in connect\nself.sock = 
> self._get_socket(host, port, self.timeout)\n  File 
> \"/usr/lib64/python2.6/smtplib.py\", line 278, in _get_socket\nreturn 
> socket.create_connection((port, host), timeout)\n  File 
> \"/usr/lib64/python2.6/socket.py\", line 567, in create_connection\n
> raise error, msg\nsocket.error: [Errno 111] Connection refused\n", 
> "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}*
>
> /var/log/messages shows the following abrtd errors which appear to come 
> from python and ansible_module_mail.py:
>
>
>
> *Mar  5 17:45:13  abrt: [ID - user.info 
> ]  detected unhandled Python exception in 
> '/tmp/ansible_TNdcry/ansible_module_mail.py'Mar  5 17:45:14 
>  abrtd: [ID - daemon.err]  Directory 
> 'pyhook-2018-03-05-17:45:14-17875' creation detectedMar  5 17:45:14 
>  abrt-server[18081]: [ID - daemon.err]  Saved Python 
> crash dump of pid 17875 to /var/spool/abrt/pyhook-2018-03-05-17:45:14-17875*
>
> What I don't know is whether this is ansible and/or python, or perhaps my 
> poor implementation of the mail module.  Google search has not returned any 
> worthy suggestions or causes.  Could I be missing something server side - 
> python config or sendmail?
> Does anyone have any ideas?
>
> Version information:
>
>  
>
>
>
>
> * ansible 2.4.3.0  config file = /etc/ansible/ansible.cfg  configured 
> module search path = [u'/root/.ansible/plugins/modules', 
> u'/usr/share/ansible/plugins/modules']  ansible python module location = 
> /usr/lib/python2.6/site-packages/ansible  executable location = 
> /usr/bin/ansible  python version = 2.6.6 (r266:84292, Aug  9 2016, 
> 06:11:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]*
>
> -Simon
>

-- 
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/93303546-d190-40b8-a2e8-29978770f313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.