1. 플러그인 설치 ansible plugin
2. Global Tool Config

3. Credential 추가 - system - global credentials

4. 빌드 추가 invoke ansible ad-hoc command

5. credential 등록을 했음에도 에러가 난다…

6. jenkins 권한으로도 ssh key를 등록해야한다.
root에서는 ansible all -a “ls” 명령이 잘된다.
jenkins로 변경 후 테스트1
2
3
4
5
6su -s /bin/bash jenkins
xxx.xxx.xxx.xxx | UNREACHABLE! => {
"changed": false, 
"msg": "Failed to connect to the host via ssh: Warning: Permanently added 'xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic,password).", 
"unreachable": true
}
ssh 위치는 /var/lib/jenkins/.ssh
root .ssh/ 파일들을 복사해준다.
| 1 | ansible all -a "ls" | 
7. 최종 빌드 테스트
