类型错误:'NoneType'对象在 ansible 输出中不可迭代



我已经使用以下docker图像建立了一个可靠的塔

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中的邮件模块的脚本时,ansible塔输出中显示了以下错误

fatal: [Server]: FAILED! => {
"changed": false, 
"module_stderr": "Shared connection to x.x.x.x closed.rn", 
"module_stdout": "rnTraceback (most recent call last):rn  File "/home/ansible/.ansible/tmp/ansible-tmp-1549369654.27-211111564926363/AnsiballZ_mail.py", line 113, in <module>rn    _ansiballz_main()rn  File "/home/ansible/.ansible/tmp/ansible-tmp-1549369654.27-211111564926363/AnsiballZ_mail.py", line 105, in _ansiballz_mainrn    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)rn  File "/home/ansible/.ansible/tmp/ansible-tmp-1549369654.27-211111564926363/AnsiballZ_mail.py", line 48, in invoke_modulern    imp.load_module('__main__', mod, module, MOD_DESC)rn  File "/tmp/ansible_mail_payload_bQeVQh/__main__.py", line 381, in <module>rn  File "/tmp/ansible_mail_payload_bQeVQh/__main__.py", line 330, in mainrnTypeError: 'NoneType' object is not iterablern", 
"msg": "MODULE FAILUREnSee 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塔发送通知,但不能通过ansibl中的邮件模块。但我希望邮件能自动通过可翻译的脚本发送。但这并没有发生。。

您的实际错误在module_stdoutTypeError: 'NoneType' object is not iterable中。必须引用null或未知变量类型的变量。

最新更新