默认Playbook会检查tasks执行的返回状态(rc) ,如遇到错误则(rc!=0) 会立即终止playbook的后续的tasks执行。然而有些时候palybook即使执行错误了也要让其继续执行
加入参数: ignore_errors: yes 忽略错误,例如:
cat 27.yml
---
- hosts: allremote_user: roottasks:- name: Ignore Falsecommand: /bin/falseignore_errors: yes- name: touch new filefile: path=/tmp/ignore state=touch
ansible-playbook 27.yml
# 会发现即使执行报错了,但是下面的任务继续执行。