在 Ansible Playbook 中,默认情况下,如果某个任务执行失败,后续任务将不会被执行。如果要跳过错误继续执行,需要使用 'ignore_errors' 参数。

将 'ignore_errors' 参数设置为 'true',即可在任务执行失败时跳过错误,继续执行后续任务。例如:

- name: some task
  command: '/path/to/some/command'
  ignore_errors: true

此时,如果 '/path/to/some/command' 执行失败,后续任务将不会被中断,继续执行。

Ansible Playbook: 如何跳过错误继续执行任务

原文地址: https://www.cveoy.top/t/topic/oAZ2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录