Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 3. Red Hat support for cloud-init
Red Hat supports the cloud-init utility, cloud-init modules, and default directories and files across various Red Hat products.
3.1. cloud-init significant directories and files Link kopierenLink in die Zwischenablage kopiert!
By using directories and files in the following table, you can perform tasks such as:
-
Configuring
cloud-init -
Finding information about your configuration after
cloud-inithas run - Examining log files
- Finding templates
Depending on your scenario and datasource, there can be additional files and directories important to your configuration.
| Directory or File | Description |
|---|---|
|
|
The |
|
|
The |
|
|
When |
|
|
The |
|
|
This directory includes templates that you can enable in |
|
|
The |
|
|
The |
3.2. Red Hat products that use cloud-init Link kopierenLink in die Zwischenablage kopiert!
You can use cloud-init with these Red Hat products:
-
Red Hat Virtualization. Once you install
cloud-initon a VM, you can create a template and leveragecloud-initfunctions for all VMs created from that template. Refer to Using Cloud-Init to Automate the Configuration of Virtual Machines for information about usingcloud-initwith VMs. -
Red Hat OpenStack Platform. You can use
cloud-initto help configure images for OpenStack. Refer to the Instances and Images Guide for more information. -
Red Hat Satellite. You can use
cloud-initwith Red Hat Satellite. Refer to Preparing Cloud-init Images in Red Hat Virtualization for more information. -
Red Hat OpenShift. You can use
cloud-initwhen you create VMs for OpenShift. Refer to Creating Virtual Machines for more information.
3.3. Red Hat supports these cloud-init modules Link kopierenLink in die Zwischenablage kopiert!
Red Hat supports most cloud-init modules. Individual modules can contain multiple configuration options. In the following table, you can find all of the cloud-init modules that Red Hat currently supports and provides a brief description and the default module frequency. Refer to Modules in the cloud-init Documentation section for complete descriptions and options for these modules.
| cloud-init Module | Description | Default Module Frequency |
|---|---|---|
| bootcmd | Runs commands early in the boot process | per always |
| ca_certs | Adds CA certificates | per instance |
| debug | Enables or disables output of internal information to assist with debugging | per instance |
| disable_ec2_metadata | Enables or disables the AWS EC2 metadata | per always |
| disk_setup | Configures simple partition tables and file systems | per instance |
| final_message |
Specifies the output message once | per always |
| foo | Example shows module structure (Module does nothing) | per instance |
| growpart | Resizes partitions to fill the available disk space | per always |
| keys_to_console | Allows controls of fingerprints and keys that can be written to the console | per instance |
| landscape | Installs and configures a landscape client | per instance |
| locale | Configures the system locale and applies it system-wide | per instance |
| mcollective |
Installs, configures, and starts | per instance |
| migrator |
Moves old versions of | per always |
| mounts | Configures mount points and swap files | per instance |
| phone_home | Posts data to a remote host after boot completes | per instance |
| power_state_change | Completes shutdown and reboot after all configuration modules have run | per instance |
| puppet | Installs and configures puppet | per instance |
| resizefs | Resizes a file system to use all available space on a partition | per always |
| resolv_conf |
Configures | per instance |
| rh_subscription | Registers a Red Hat Enterprise Linux system | per instance |
| rightscale_userdata |
Adds support for RightScale configuration hooks to | per instance |
| rsyslog |
Configures remote system logging using | per instance |
| runcmd | Runs arbitrary commands | per instance |
| salt_minion |
Installs, configures, and starts | per instance |
| scripts_per_boot | Runs per boot scripts | per always |
| scripts_per_instance | Runs per instance scripts | per instance |
| scripts_per_once | Runs scripts once | per once |
| scripts_user | Runs user scripts | per instance |
| scripts_vendor | Runs vendor scripts | per instance |
| seed_random | Provides random seed data | per instance |
| set_hostname | Sets host name and fully qualified domain name (FQDN) | per always |
| set_passwords | Sets user passwords and enables or disables SSH password authentication | per instance |
| ssh_authkey_fingerprints | Logs fingerprints of user SSH keys | per instance |
| ssh_import_id | Imports SSH keys | per instance |
| ssh | Configures SSH, and host and authorized SSH keys | per instance |
| timezone | Sets the system time zone | per instance |
| update_etc_hosts |
Updates | per always |
| update_hostname | Updates host name and FQDN | per always |
| users_groups | Configures users and groups | per instance |
| write_files | Writes arbitrary files | per instance |
| yum_add_repo | Adds yum repository configuration to the system | per always |
The following list of modules is not supported by Red Hat:
| Module |
|---|
| apt_configure |
| apt_pipeline |
| byobu |
| chef |
| emit_upstart |
| grub_dpkg |
| ubuntu_init_switch |
3.4. The default cloud.cfg file Link kopierenLink in die Zwischenablage kopiert!
The /etc/cloud/cloud.cfg file lists the modules comprising the basic configuration for cloud-init.
The modules in the file are the default modules for cloud-init. You can configure the modules for your environment or remove modules you do not need. Modules that are included in cloud.cfg do not necessarily do anything by being listed in the file. You need to configure them individually if you want them to perform actions during one of the cloud-init phases.
The cloud.cfg file provides the chronology for running individual modules. You can add additional modules to cloud.cfg as long as Red Hat supports the modules you want to add.
The default contents of the file for Red Hat Enterprise Linux (RHEL) are as follows:
-
Modules run in the order given in
cloud.cfg. You typically do not change this order. -
The
cloud.cfgdirectives can be overridden by user data. -
When running
cloud-initmanually, you can overridecloud.cfgwith command line options. - Each module includes its own configuration options, where you can add specific information.
-
To ensure optimal functionality of the configuration, prefer using module names with underscores (
_) rather than dashes (-).
Notable parameters
-
usersspecifies the default user for the system. For more information, see Users and Groups. -
disable_rootenables or disables root login. For more information, see Authorized Keys. -
ssh_pwauthspecifies whethersshis configured to accept password authentication. For more information, see Set Passwords. -
mount_default_fieldsconfigures mount points. It must be a list containing six values. For more information, see Mounts. -
ssh_deletekeysspecifies whether to remove default host SSH keys. For more information, see Host Keys. -
ssh_genkeytypesspecifies key types to generate. For more information, see Host Keys. -
syslog_fix_permsconfigurescloud-initto log all boot stages to its log file. For more information, see thecloud-config.txtfile in theusr/share/doc/cloud-init/examplesdirectory. -
disable_vmware_customizationenables or disables VMware vSphere customization. -
cloud_init_modules:The modules in this section are services that run when thecloud-initservice starts, early in the boot process. -
cloud_config_modules:These modules run duringcloud-initconfiguration, after initial boot. -
cloud_final_modules:These modules run in the final phase ofcloud-init, after the configuration finishes. -
default_userspecifies details about the default user. For more information. see Users and Groups. -
distro:specifies the distribution. -
cloud_dirspecifies the main directory that containscloud-init-specific subdirectories. For more information, see Directory layout. -
templates_dirspecifies where templates are located. -
ssh_svcnameis the name of the SSH service.
3.5. The cloud.cfg.d directory Link kopierenLink in die Zwischenablage kopiert!
cloud-init acts upon directives that you provide and configure. Typically, those directives are included in the cloud.cfg.d directory.
While you can configure modules by adding user data directives within the cloud.cfg file, as a best practice consider leaving cloud.cfg unmodified. Add your directives to the /etc/cloud/cloud.cfg.d directory. Adding directives to this directory can make future modifications and upgrades easier.
There are multiple ways to add directives. You can include directives in a file named *.cfg, which includes the heading #cloud-config. Typically, the directory would contain multiple *cfg files. There are other options for adding directives, for example, you can add a user data script. Refer to User-Data Formats for more information.
3.6. The default 05_logging.cfg file Link kopierenLink in die Zwischenablage kopiert!
The 05_logging.cfg file sets logging information for cloud-init. The /etc/cloud/cloud.cfg.d directory includes this file, along with other cloud-init directives that you add.
cloud-init uses the logging configuration in 05_logging.cfg by default. The default contents of the file for Red Hat Enterprise Linux (RHEL) are as follows:
3.7. The cloud-init /var/lib/cloud directory layout Link kopierenLink in die Zwischenablage kopiert!
When cloud-init first runs, it creates a directory layout that includes information about your instance and cloud-init configuration.
The directory can include optional directories, such as /scripts/vendor.
The following is a sample directory layout for cloud-init: