Attempting to send an email via ansible and running into issues. Here is the
playbook
- hosts: localhost
gather_facts: no
vars_files:
- group_vars/vars
tasks:
- name: send an email
community.general.mail:
host: signed.wlu.ca
port: 25
from: "{{ from }}"
to: "{{ email }}"
subject: test
body: test
I can ping the smtp server and telnet to he port. So not sure why the
connection is not happening.
Here are the results
File "/usr/lib64/python3.9/socket.py", line 831, in create_connection
sock.connect(sa)
socket.timeout: timed out
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File
\"/home/devops/.ansible/tmp/ansible-tmp-1657809942.2336397-28132-177526377597996/AnsiballZ_mail.py\",
line 107, in <module>\n _ansiballz_main()\n File
\"/home/devops/.ansible/tmp/ansible-tmp-1657809942.2336397-28132-177526377597996/AnsiballZ_mail.py\",
line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path,
ANSIBALLZ_PARAMS)\n File
\"/home/devops/.ansible/tmp/ansible-tmp-1657809942.2336397-28132-177526377597996/AnsiballZ_mail.py\",
line 47, in invoke_module\n
runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.mail',
init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.mail',
_modlib_path=modlib_path),\n File \"/usr/lib64/python3.9/runpy.py\", line
210, in run_module\n return _run_module_code(code, init_globals, run_name,
mod_spec)\n File \"/usr/lib64/python3.9/runpy.py\", line 97, in
_run_module_code\n _run_code(code, mod_globals, init_globals,\n File
\"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n exec(code,
run_globals)\n File
\"/tmp/ansible_community.general.mail_payload_05j97ys9/ansible_community.general.mail_payload.zip/ansible_collections/community/general/plugins/modules/mail.py\",
line 408, in <module>\n File
\"/tmp/ansible_community.general.mail_payload_05j97ys9/ansible_community.general.mail_payload.zip/ansible_collections/community/general/plugins/modules/mail.py\",
line 293, in main\n File \"/usr/lib64/python3.9/smtplib.py\", line 255, in
__init__\n (code, msg) = self.connect(host, port)\n File
\"/usr/lib64/python3.9/smtplib.py\", line 341, in connect\n self.sock =
self._get_socket(host, port, self.timeout)\n File
\"/usr/lib64/python3.9/smtplib.py\", line 312, in _get_socket\n return
socket.create_connection((host, port), timeout,\n File
\"/usr/lib64/python3.9/socket.py\", line 843, in create_connection\n raise
err\n File \"/usr/lib64/python3.9/socket.py\", line 831, in
create_connection\n sock.connect(sa)\nsocket.timeout: timed out\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
Thank you,
********************************
Rene Paquin - Systems Administrator
Wilfrid Laurier University
Waterloo, Ontario
(519)884-0710 x3795
[email protected]<mailto:[email protected]>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/YT2PR01MB6256A8D71FE474125FCEC1F2D8889%40YT2PR01MB6256.CANPRD01.PROD.OUTLOOK.COM.