2017-12-12 3 views
0

소프트웨어를 제거해야하고 해당 소프트웨어를 제거하는 동안 yes or no으로 답을 찾으십시오. 아래 샘플을 참조하십시오. 내가 그것을 그러므로 내가 나를 위해 일을 ansible을 찾고 있어요해야 할 여러 리눅스 시스템을 가지고, 그래서 같이 함께 작동하는 다음과 같이 이제사전 답변이있는 프롬프트에 응답 할 수 있습니다.

# /opt/altiris/notification/nsagent/bin/aex-uninstall 
This will remove the Symantec Management Agent for UNIX, Linux and Mac software from your system. 

Are you sure you want to continue [Yy/Nn]? 

은, 난 그냥 ansible adhoc 방법과 같은 테스트 한 shell 모듈 ...

# ansible all -m shell -a 'echo "y" | /opt/altiris/notification/nsagent/bin/aex-uninstall' 
dev-karn | SUCCESS | rc=0 >> 
This will remove the Symantec Management Agent for UNIX, Linux and Mac software from your system. 

Are you sure you want to continue [Yy/Nn]? 

Uninstalling dependant solutions... 
Uninstalling dependant solutions finished. 

Removing Symantec Management Agent for UNIX, Linux and Mac package from the system... 
Removing wrapper scripts and links for applications... 
Sending uninstall events to NS 
Stopping Symantec Management Agent for UNIX, Linux and Mac: [ OK ] 
Remove non packaged files. 
Symantec Management Agent for UNIX, Linux and Mac Configuration utility. 
    Removing aex-* links in /usr/bin 
    Removing RC init links and scripts 
Cleaning up after final package removal. 
Removal finished. 

이 그것을 할 수있는 bettwr의 방법이 ... 어떤 아이디어가 많이 이해할 수있을 것이다.

답변

1

사용자는 expect 모듈을 사용해야합니다.

+0

thnx 되돌아 가기, 나는 그럴 수있는 문서를 보았습니다. 그러나 'yes'유틸리티를 사용하여 해결책으로 끝났습니다. 어떤 fullfils 요구 사항을 반복적으로 출력합니까? – krock1516

0

리눅스 쉘의 yes 유틸리티는 반복 따라서, yes 진행하는 경우에만 답을해야 내가 실행 해요 프로그램으로 내 요구 사항 같은 프로그램 등으로 프롬프트를 추구하는 모든 사전 답변의 neccessity을 충족 y를 출력 내가

$ ansible all -m shell -a '/bin/yes | /opt/altiris/notification/nsagent/bin/aex-uninstall' 

그래서, 심지어 echo "y"이 neeed하지 않습니다 ... ansible shell 모듈을 아래로 사용했다.

Thnx - Karn