2016-07-27 6 views
3

Packer와 RancherOS에 문제가 있습니다. cloud-config 파일로 사용자 정의 rancherOS 이미지를 작성하려고합니다. 저는 MacOSX에서 일하고 있습니다.Packer로 RancherOS를 구축 할 때 SSH가 실패했습니다

나는 내가 cloud-config.yml 키 단지 내 SSH를 포함이이 build.json 파일 측면을 따라

{ 
    "variables": { 
     "vm_name" : "" 
    }, 
    "builders": [ 
     { 
      "type": "vmware-iso", 
      "iso_url": "rancheros.iso", 
      "guest_os_type": "other", 
      "iso_checksum_type": "md5", 
      "iso_checksum": "467caa8394684ba54e8731aed8480652", 
      "output_directory": "output_rancheros", 
      "ssh_wait_timeout": "30s", 
      "shutdown_command": "sudo shutdown -h now", 
      "disk_size": 20000, 
      "ssh_username": "rancher", 
      "ssh_password": "rancher", 
      "ssh_port": 22, 
      "ssh_wait_timeout": "90m", 
      "vm_name": "{{ user `vm_name` }}", 
      "boot_wait": "10s", 
      "vmx_data": { 
       "memsize": "4096" 
      } 
     } 
    ], 
    "provisioners": [ 
     { 
      "type":"file", 
      "source": "cloud-config.yml", 
      "destination": "/tmp/cloud-config.yml" 
     }, 
     { 
      "type": "shell", 
      "inline": [ 
       "sudo ros install -d /dev/sda -f -t generic -c /tmp/cloud-config.yml" 
      ] 
     } 
    ] 
} 

#cloud-config 
ssh_authorized_keys: 
    - ssh-rsa AAAA....d [email protected] 

내가 얻을 packer build build.json

건물 명령을 실행

vmware-iso: + umount /mnt/new_img 
    vmware-iso: time="2016-07-27T05:52:35Z" level=fatal msg=EOF 
    vmware-iso: Continue with reboot [y/N]: 
==> vmware-iso: Stopping virtual machine... 
==> vmware-iso: Deleting output directory... 
Build 'vmware-iso' errored: Script exited with non-zero exit status: 1 

==> Some builds didn't complete successfully and had errors: 
--> vmware-iso: Script exited with non-zero exit status: 1 

==> Builds finished but no artifacts were created. 

정확하게 이해하면. 내 스크립트가 작동하지만 VM이 다시 부팅되면 새 SSH 키가 작동하지 않습니다.

이 문제를 해결하는 방법을 모르겠습니다. 아마 누군가 나를 도울 것입니다.

안부

+0

packer ssh 시간 초과 문제가 있습니까? 나는 거의 동일한 json을 사용한다. (VM웨어 대신 vbox를 사용하는 것을 제외하고) 나는 그것에 접속할 수 없다. 오류 : "빌드 '가상 박스 - iso'오류 : ssh : 핸드 셰이크 실패 : ssh : 인증 할 수없는 메소드 [비밀번호 키보드 - 대화식 없음], 지원되는 메소드가 남아 있지 않음" –

+0

VirtualBox를 사용해 본 적이 없으며 내가 도울 수 있도록 StackOverflow에 게시 하시겠습니까? 최소한 template.json 파일이 필요합니다. 덕분에 – Sapher

+0

. https://stackoverflow.com/questions/49133676/handshake-failed-ssh-unable-to-authenticate-attempted-methods-none-password –

답변

4

나는 그냥 sudo ros install -d /dev/sda -f -t generic -c /tmp/cloud-config.yml 명령에 -no-reboot 플래그를 추가 트릭을 할 솔루션을

을 발견했다.

생성하는 동안 다시 부팅 할 필요가 없습니다.