2017-09-15 8 views
1

데비안 9.1을 실행 중이며 cloud-init을 사용하여 생성시 VPS를 구성하고 싶습니다. 특정 구성 문제가 있습니다. cloud-init이 실행 순서를 강제하는 방법이 있습니까?

제공된 스냅 샷에서 cloud.cfg의 기본값입니다 :

# The modules that run in the 'init' stage 
cloud_init_modules: 
- migrator 
- seed_random 
- bootcmd 
- write-files 
- growpart 
- resizefs 
- disk_setup 
- mounts 
- set_hostname 
- update_hostname 
- update_etc_hosts 
- ca-certs 
- rsyslog 
- users-groups 
- ssh 

# The modules that run in the 'config' stage 
cloud_config_modules: 
# Emit my cloud config ready event 
# this can be used by upstart jobs for 'start on cloud-config'. 
- emit_upstart 
- ssh-import-id 
- locale 
- set-passwords 
- grub-dpkg 
- apt-pipelining 
- apt-configure 
- ntp 
- timezone 
- disable-ec2-metadata 
- runcmd 
- byobu 

# The modules that run in the 'final' stage 
cloud_final_modules: 
- package-update-upgrade-install 
- fan 
- puppet 
- chef 
- salt-minion 
- mcollective 
- rightscale_userdata 
- scripts-vendor 
- scripts-per-once 
- scripts-per-boot 
- scripts-per-instance 
- scripts-user 
- ssh-authkey-fingerprints 
- keys-to-console 
- phone-home 
- final-message 
- power-state-change 

당신이 볼 수 있듯이이 runcmd를가 쉽다 - 구성 후 설정 단계에서 실행됩니다.

구성의 일부로 여러 패키지를 설치하는데, 그 중 하나는 새 소스를 추가하고 키 서버에서 키를 가져와야합니다. 키를 가져 오려면 시스템에 dirmngr을 설치해야하지만 데비안 9.1에는 기본적으로 설치되어 있지 않으므로 문제가 있습니다.

그러나 apt-configure가 runcmd보다 먼저 실행되기 때문에 키를 가져 오기 전에 dirmngr을 설치할 수 없습니다. 결과적으로 나머지 구성은 실패하고 시스템은 원치 않는 상태가됩니다.

이 문제를 해결하려면 어떻게해야합니까? cloud-init 구성을 얻을 수 있기 때문에

# APT fails to acquire GPG keys if package dirmngr is missing 
bootcmd: 
    - [ cloud-init-per, once, dirmngr-aptupdate, apt-get, update ] 
    - [ cloud-init-per, once, dirmngr-aptinstall, apt-get, install, dirmngr ] 

다음 apt-configure 모듈의 고장의 원인이 데비안 9.1에 dirmngr 패키지 누락의 특정한 경우에 대해서는

답변

1

, 내 cloud-init 구성에 다음 bootcmd 항목을 추가 성공이 있었다 (나는 EC2 사용자 데이터를 사용하고있다) 네트워크에서 bootcmd이 실행될 때 네트워크가 작동 될 것임을 보증한다. cloud-init-per 프로그램을 사용하면 이러한 명령을 나중에 인스턴스를 부팅 할 때 다시 실행하지 않아도됩니다.