安装成功,但Ansible报告失败
问题描述:
我有一个简单的剧本,预计将安装一个Windows应用程序 -安装成功,但Ansible报告失败
--
- name: Install the <application>
hosts: all
tasks:
- name: Installation of <application>
raw: cmd /c "<path to setup> /s <appname> /n ACCEPT_EULA=1"
应用程序安装成功,但在报道“失败”的Ansible塔。
标准输出过这样的信息 -
TASK [Installation of <application_name>] ************************************************
task path: /var/lib/awx/projects/tests/<file>.yml:6
fatal: [xxx.163.xxx.69]: FAILED! => {"changed": false, "failed": true, "rc": 1, "stderr": "", "stdout": "", "stdout_lines": []}
NO MORE HOSTS LEFT *************************************************************
[ERROR]: Could not create retry file '<file>_bat.retry'. The error was: [Errno
13] Permission denied: '<file>_bat.retry'
我能摆脱“无法创建重试”文件错误的取消注释retry_files_enabled =假,但致命故障仍持续出现。
如何确保Ansible报告“已更改”:是吗?
答
的任务失败,因为该命令的返回代码为1(输出注意"rc": 1
。)
如果这一预期,就可以使用failed_when
指定不同的故障情况,或ignore_errors
忽略所有任务失败。有关更多详细信息,请参阅https://docs.ansible.com/ansible/playbooks_error_handling.html。