The problem show up only when I use Ansible AWX to run playbook. There was no problem when I run the Anisble-palybook CLI.
I’m running a simple playbook to report on server configurations. I have a shell script to get system health check and then using mail module to send output of shell script into the body of the mail as follows:
- name: Email Notification about health check mail: body: ‘{{ script_output.stdout_lines | to_nice_yaml }}’ charset: utf8 delegate_to: localhost tags: hmail
Can you post more information? What error message are you getting? What Ansible version are you running on CLI? What Ansible version are you running on AWX?
Also, if this is running in the AWX container it’s entirely possible that those are just dead lettered automatically. You should see if the built in mail facilities even work at all in the container. The mail module in Ansible (and the Tower mail notification type) can both take upstream smtp server connection information. Sometimes traditional mail sending is blocked by ISPs and hosting providers (Amazon will block outgoing port 25 on ec2 hosts for example). It looks like you are just trying to send it out through local mail facilities which, like I said, may just plain not work from the AWX container.
There are many reasons a system can’t deliver mail, I’d exhaust all of those before I believe there is a bug in AWX.
I do receive email from the client machine when I run the same playbook using ansible-playbook command line. This happens only when I execute from AWX.
And port 25 is open on the client server. You mean, should I configure postfix on awx web docker?