与x.x.x.x的共享连接在有效输出中关闭

时间:2019-02-05 13:08:28

标签: python docker ssl ansible

我已经使用以下docker镜像建立了一个ansible塔

ybalt/ansible-tower:latest

设置后,我已通过

升级了容器内的应用程序
apt-get upgrade

在那之后是我的conatiner中的版本

ansible 2.7.6
  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.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Jul 18 2016, 15:02:52) [GCC 4.8.4]

然后,当我执行在ansible中使用mail模块的脚本时,在ansible塔输出中显示以下错误

fatal: [Server]: FAILED! => {
    "changed": false, 
    "module_stderr": "Shared connection to x.x.x.x closed.\r\n", 
    "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1549369654.27-211111564926363/AnsiballZ_mail.py\", line 113, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1549369654.27-211111564926363/AnsiballZ_mail.py\", line 105, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1549369654.27-211111564926363/AnsiballZ_mail.py\", line 48, in invoke_module\r\n    imp.load_module('__main__', mod, module, MOD_DESC)\r\n  File \"/tmp/ansible_mail_payload_bQeVQh/__main__.py\", line 381, in <module>\r\n  File \"/tmp/ansible_mail_payload_bQeVQh/__main__.py\", line 330, in main\r\nTypeError: 'NoneType' object is not iterable\r\n", 
    "msg": "MODULE FAILURE\nSee stdo…

我已经开发了带有电子邮件配置的单独的手册,以便从任何游戏手册中进行参考。因此,以下是我在剧本中定义的变量

email_host: "smtp.sendgrid.net"
email_port: 587
email_username: "username"
email_password: "password"
email_to: "admin@example.com"
email_cc:
email_subject: "test"
email_body:
email_subtype: "html"
email_secure: "try"
email_from: "noreply@example.com ( Ansible Tower )"
email_bcc:
email_attach: 

以下是我从其他剧本中引用上述电子邮件剧本的方式

- name: Email body on failure
  set_fact:
    email_body="Hi {{ tower_user_name }}, <br><br> Status - Failed
                                                                  <br> Issue - Build path or given build name doesn't exist
                                                                  <br> Suggested Solution - Check the validity of the build path or the build name.
                                                                  <br><br> Thank You"

- name: Sending an email
  include_role:
    name: email
    tasks_from: main.yml
  when: path_build_location.stat.exists == False

但是,当该部分触发时,以及第二本剧本尝试发送电子邮件时。我收到上述错误。我的ansible配置文件中的变量被完全注释掉,所有这些都被ansible塔变量所覆盖。所有配置均经过重新检查,并符合相关文档说明。我什至可以通过ansible塔发送通知,但不能通过ansible中的邮件模块发送通知。但是我希望通过ansible脚本自动发送邮件。但这并没有发生。.

0 个答案:

没有答案