安装成功但Ansible报告失败

时间:2016-04-29 07:52:33

标签: ansible ansible-playbook

我有一个简单的playbook,预计会安装一个Windows应用程序 -

var itemsProcessed = 0;
for (var index = 0; index < uniqueIdentifiers.length; index++) {
  let uniqueIdentifier = uniqueIdentifiers[index];

  // ESLint: Don't make functions within a loop (no-loop-func)
  var removeFileReferenceCallback = function (removeReferenceError) {
    if (removeReferenceError !== null) {
      NotificationSystem.logReferenceNotRemoved(uniqueIdentifier, undefined);
    }

    // When all items are removed, use the callback
    if (++itemsProcessed === uniqueIdentifiers.length) {
      callback(null);
    }
  };

  // Remove the reference
  this.database.removeFileReference(uniqueIdentifier, removeFileReferenceCallback);
}

应用程序安装成功但报告失败&#39;通过Ansible Tower。

标准输出有此信息 -

--
- name: Install the <application>
  hosts: all 

  tasks:
  - name: Installation of <application>
    raw: cmd /c "<path to setup> /s <appname> /n ACCEPT_EULA=1"

我可以摆脱“无法创造重试”的问题。通过取消注释retry_files_enabled = False但致命失败仍然继续出现而导致文件错误。

如何确保Ansible报告&#34;已更改&#34;:是吗?

1 个答案:

答案 0 :(得分:1)

任务失败,因为命令的返回码是1.(注意输出中的"rc": 1。)

如果需要,可以使用failed_when指定其他失败条件,或ignore_errors忽略该任务的所有失败。有关详细信息,请参阅https://docs.ansible.com/ansible/playbooks_error_handling.html