cloud-init主要用于处理instance的初始化配置,如网络、ssh,yum源等。支持多种类型的datasource,如NoCloud, ConfigDrive, OpenNebula, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, Ec2, CloudStack, SmartOS等,openstack用metadata,config driver配置instance。

执行操作

1.cloud-init提供三个配置Instance的操作命令cloud-init/cloud-module/cloud-single

2.Instance启动时依次执行命令行配置Instance

       a.  cloud-init init --local

       b.  cloud-init init

       c.  cloud-init modules --mode=config

       d.  cloud-init modules --mode=final

3.文件/etc/cloud/cloud.conf分别配置init,config,final阶段执行操作,如下所示:

 1 # The modules that run in the 'init' stage
 2 cloud_init_modules:
 3  - migrator
 4  - seed_random
 5  - bootcmd
 6  - write-files
 7  - growpart
 8  - resizefs
 9  - set_hostname
10  - update_hostname
11  - update_etc_hosts
12  - ca-certs
13  - rsyslog
14  - users-groups
15  - ssh
16 # The modules that run in the 'config' stage
17 cloud_config_modules:
18 # Emit the cloud config ready event
19 # this can be used by upstart jobs for 'start on cloud-config'.
20  - emit_upstart
21  - disk_setup
22  - mounts
23  - ssh-import-id
24  - locale
25  - set-passwords
26  - grub-dpkg
27  - apt-pipelining
28  - apt-configure
29  - package-update-upgrade-install
30  - landscape
31  - timezone
32  - puppet
33  - chef
34  - salt-minion
35  - mcollective
36  - disable-ec2-metadata
37  - runcmd
38  - byobu
39 # The modules that run in the 'final' stage
40 cloud_final_modules:
41  - rightscale_userdata
42  - scripts-vendor
43  - scripts-per-once
44  - scripts-per-boot
45  - scripts-per-instance
46  - scripts-user
47  - ssh-authkey-fingerprints
48  - keys-to-console
49  - phone-home
50  - final-message
51  - power-state-change
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2023-03-21
猜你喜欢
  • 2022-01-31
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-12-09
  • 2021-08-26
相关资源
相似解决方案