2017-10-16 1 views
1

나는 2.4.0을 사용할 수 있으며 검사 모드에 따라 ignore_errors을 사용하고 with_items을 조합하여 사용하려고합니다. docs about check_mode에 따르면 관리자가 check 모드로 실행 중인지 여부에 따라 ignore_errors를 정의 할 수 있습니다. with_items 지시문이 없으면이 방법이 잘 작동하지만 두 요소 모두 fail은 항상 무시됩니다. 예를 들어 작업루프 내에서 가능한 ignore_errors 사용

with_items없이 :

# test_i.yml 
- name: test without array and with ignore 
    hosts: all 
    gather_facts: no 
    tasks: 
    - fail: msg="I fail, but ignored in check mode" 
     ignore_errors: "{{ ansible_check_mode }}" 

    - debug: msg="Reachable only in check mode" 

작동하지 예 :

# test_ai.yml 
- name: test with array and with ignore 
    hosts: all 
    gather_facts: no 
    tasks: 
    - fail: msg="I am always skipped" 
     ignore_errors: "{{ ansible_check_mode }}" 
     with_items: [ 1, 2 ] 

    - debug: msg="Always reached" 

으로 실행하고 결과 :

ansible-playbook test_i.yml --check 
# ok=2, failed=0, but fail-task printed in red 
ansible-playbook test_i.yml 
# ok=0, failed=1, canceled after fail task 
ansible-playbook test_ai.yml --check 
# ok=2, failed=0, but fail-task items printed in red 
ansible-playbook test_ai.yml 
# ok=2, failed=0, same as with check 

제거하거나 주석 처리되어있는 ignore_errors 경우, 작업 원하는대로 실패하지만 검사 모드에서도 마찬가지입니다. check_mode이 false로 정의 되더라도 작동합니다.하지만 이는 의미가 없습니다.

내가 누락되었거나 버그 일 수 있습니까?

+0

'fail' 모듈이 다른 액션 모듈이 실패 할 때와 같은 방식으로 동작하는 것을 반드시 신뢰하지는 않습니다. 당신의 목표는 무엇입니까? 일반 응답/솔루션을 원하거나 특히 '실패'를 원하십니까? – techraf

답변

2

예, 이것은 버그입니다. 나는 설명과 함께 31831 호를 제출했다.

+0

문제를 조사하고 제기 해 주셔서 감사합니다. – clemens321