2016-08-08 2 views

답변

1

. httpd가 존재하지 않으면, 플레이 북 실행이 실패합니다. ignore_errors을 사용하여 실행을 계속 한 후 httpd_result의 리턴 코드에 따라 후속 타스크를 실행할 수 있습니다. 아래 예제를 보았습니다.

- hosts: localhost 
    tasks: 
    - command: "which httpd" 
     register: httpd_result 
     ignore_errors: true 
    - debug: msg="found http" 
     when: httpd_result.rc == 0 
    - debug: msg="not found httpd" 
     when: httpd_result.rc!=0 

여기서 디버그 문 대신 실행해야하는 조건부 작업을 넣을 수 있습니다. 희망이 도움이됩니다.

관련 문제