2017-09-15 4 views
1

私はDebian 9.1を実行しています。作成時にVPSをcloud-initを使って設定したいのですが、設定に問題があります。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はのapt-構成した後、設定段階で実行されます。

構成の一部として、複数のパッケージをインストールしています。そのうちの1つは、新しいソースを追加し、キーサーバーからキーをインポートする必要があります。キーをインポートするには、システムにdirmngrをインストールする必要がありますが、Debian 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モジュールの故障の原因となるのDebian 9.1にdirmngrパッケージを逃すの特定の場合については、私は私のcloud-init設定に以下のbootcmdエントリを追加することで成功を収めている

答えて

1

(私はEC2ユーザデータを使用しています)ネットワークから、bootcmdが実行されると、ネットワークがアップしていることが保証されます。 cloud-init-perプログラムを使用すると、これらのコマンドがその後のインスタンスのブート時に再実行されないようにすることが容易になります。

関連する問題