判断语句 之 failed_when
failed_when 相当于exit,可以理解为:
for i in range(10):
if i >5:
exit
else:
print(i)
- hosts: all
tasks:
- name: ansible_os_family
debug:
msg: "{{ ansible_os_family }}"
failed_when: 1 == 1
- name: 这个任务不会执行
debug:
msg: 不应该打印