Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to customize cloud-init

Shulou Source: shulou.com Published: 2022-06-01 00:43:48 10月03日 Update

This article introduces you how to customize cloud-init, the content is very detailed, interested friends can refer to, hope to be helpful to you.

For Linux images, cloud-init is responsible for initializing instance. Cloud-init is very powerful and can do a lot of things, and we can flexibly customize cloud-init by modifying the configuration file.

The configuration file of cloud-init is / etc/cloud/cloud.cfg. Here are several application scenarios:

1. If you want root to log in to instance directly (root login is not allowed by default), set:

Disable_root: 0

two。 If you want to be able to log in as ssh passwod (by default, you can only log in through private key), set:

Ssh_pwauth: 1

3. If you want to be able to modify the hostname of instance (by default, cloud-init will restore the hostname to its original value after each restart of instance), delete or comment out the following two items in the cloud_init_modules list:

-set_hostname

-update_hostname

Instance performs initialization every time it starts cloud-init. If you want to change the initialization behavior of all instance, modify the mirrored / etc/cloud/cloud.cfg file; if you only want to change the initialization behavior of an instance, modify the / etc/cloud/cloud.cfg of instance directly.

There are many options for cloud-init, and only a few common customization scenarios are listed here to give you an important idea: you can change the initialization behavior of instance through cloud-init. Please refer to the official website https://cloud-init.io/ for more information

On how to customize cloud-init to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Login file more behavior content scene mirror reference work help configuration good powerful important thing function information interest function available through Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info OPPO Reno NVidia Shulou Information