2015-12-04 35 views
14

クラウド初期化ユーザデータオブジェクトのクラウドコンフィグレーションセクション内のディレクティブの順序は?これはレースの種類の条件を避けるために重要です。cloud-init:cloud-configディレクティブの実行順序は?

私はbootcmdが早くruncmdの前で実行されていることを知っていますが、すべてのメソッドの順番の良いリストがありますか?

答えて

15

https://git.launchpad.net/cloud-init/tree/config/cloud.cfgからさらに

# The modules that run in the 'init' stage 
cloud_init_modules: 
- migrator 
- ubuntu-init-switch 
- seed_random 
- bootcmd 
- write-files 
- growpart 
- resizefs 
- 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 the cloud config ready event 
# this can be used by upstart jobs for 'start on cloud-config'. 
- emit_upstart 
- disk_setup 
- mounts 
- ssh-import-id 
- locale 
- set-passwords 
- snappy 
- grub-dpkg 
- apt-pipelining 
- apt-configure 
- package-update-upgrade-install 
- fan 
- landscape 
- timezone 
- lxd 
- puppet 
- chef 
- salt-minion 
- mcollective 
- disable-ec2-metadata 
- runcmd 
- byobu 

# The modules that run in the 'final' stage 
cloud_final_modules: 
- 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 

(おかげでgarbeliniする):

順序は次のようである「マージ設定があります: - CLI設定ファイルがどのオーバーライドインスタンスのconfigs環境設定ファイル を上書きするには、どのデータソース をオーバーライドして、 デフォルト設定を上書きする基本設定を上書きします。個々の生成されたスクリプト内で

(変更履歴を参照してください)組み込み

NOTE「()をソート」スクリプトはPythonが与えられた順序で実行されているディレクトリ:これは見て、答えるの時点で正しかったものの、 (2017年9月現在)リポジトリーは、異なるディストリビューション

# The modules that run in the 'init' stage 
cloud_init_modules: 
- migrator 
- seed_random 
- bootcmd 
- write-files 
- growpart 
- resizefs 
{% if variant not in ["freebsd"] %} 
- disk_setup 
- mounts 
{% endif %} 
- set_hostname 
- update_hostname 
{% if variant not in ["freebsd"] %} 
- update_etc_hosts 
- ca-certs 
- rsyslog 
{% endif %} 
- users-groups 
- ssh 

# The modules that run in the 'config' stage 
cloud_config_modules: 
{% if variant in ["ubuntu", "unknown", "debian"] %} 
# Emit the cloud config ready event 
# this can be used by upstart jobs for 'start on cloud-config'. 
- emit_upstart 
- snap_config 
{% endif %} 
- ssh-import-id 
- locale 
- set-passwords 
{% if variant in ["rhel", "fedora"] %} 
- spacewalk 
- yum-add-repo 
{% endif %} 
{% if variant in ["ubuntu", "unknown", "debian"] %} 
- grub-dpkg 
- apt-pipelining 
- apt-configure 
{% endif %} 
{% if variant not in ["freebsd"] %} 
- ntp 
{% endif %} 
- timezone 
- disable-ec2-metadata 
- runcmd 
{% if variant in ["ubuntu", "unknown", "debian"] %} 
- byobu 
{% endif %} 

# The modules that run in the 'final' stage 
cloud_final_modules: 
{% if variant in ["ubuntu", "unknown", "debian"] %} 
- snappy 
{% endif %} 
- package-update-upgrade-install 
{% if variant in ["ubuntu", "unknown", "debian"] %} 
- fan 
- landscape 
- lxd 
{% endif %} 
{% if variant not in ["freebsd"] %} 
- puppet 
- chef 
- salt-minion 
- mcollective 
{% endif %} 
- 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 
+0

のためのわずかに異なる設定がありcloud.cfg.tmplテンプレートファイルが用意されました上記の実行の変更を強制する方法はありますか?たとえば、aptが実行される前にdirmngrをインストールしておく必要があります(ディストリビューションでは欠落しています)。ソースキーをインポートしようとすると失敗します。それから、残りのパッケージを通常どおりにインストールしたいと思います。 – Tristan

+1

実行順序が尊重されない場合はありますか? Ubuntu Cloud 16.04イメージでは、 'runcmd'は' config'ステージに置かれ、 'package-update-upgrade-install'は' final'ステージに置かれますが、パッケージのインストール後に 'runcmd'をエラーなく実行できます。 – dvnguyen

+1

@Tristan私はapt/dpkg configに3つのステップがあることに気付きました。 – Vorsprung