当前位置:  开发笔记 > 编程语言 > 正文

cloud-init:cloud-config指令的执行顺序是什么?

如何解决《cloud-init:cloud-config指令的执行顺序是什么?》经验,为你挑选了1个好方法。

cloud-init用户数据对象的cloud-config部分中的指令顺序是什么.这对于避免种族类型的情况很重要.

我知道bootcmd在runcmd之前提前运行,但是有一个很好的列表,所有方法的顺序?



1> Vorsprung..:

来自https://git.launchpad.net/cloud-init/tree/config/cloud.cfg(感谢garbelini)

# 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

另外:

有一个配置合并"顺序如下: - cli配置文件覆盖环境配置文件,它覆盖实例配置,覆盖覆盖基本配置的数据源配置,覆盖默认配置." (见更改日志)

在单个生成的脚本目录中,脚本按照python"sorted()"内置命令的顺序运行

注意:虽然这在回答时是正确的,但是查看上面提到的存储库(截至2017年9月),现在有一个cloud.cfg.tmpl模板文件,它对不同的发行版有不同的设置

# 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

推荐阅读
mobiledu2402851203
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有