判断语句 之 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: 不应该打印
posted @ 2023-01-25 13:08  mingtian是吧  阅读(74)  评论(0编辑  收藏  举报