Cloud-init service change network configuration in every reboot

Latest response

Hi All,

I am in a big problem. I am using cloud-init-18.2-1.el7_6.1.x86_64 to create vm from template.
In the time of VM provision all going well but I shutdown and start the vm the network configuration file changed. All configuration vanished and "BOOTPROTO" changed in to "dhcp" mode.
In the time of vm creation bootporto=none, but reboot change bootporto=dhcp.

Please help me.


When booting under systemd, a generator will run that determines if should be included in the boot goals. By default, this generator will enable cloud-init. It will not enable cloud-init if either: 1. A file exists: /etc/cloud/cloud-init.disabled
 2. The kernel command line as found in /proc/cmdline contains cloud-init=disabled

In general, you want the cloud-init service to run on every boot just don't want it to run all of its components every time. That's why it has the per_boot, per_instance and per_once methods.

I also face this issue. No one can give me a solution. It is a bug. I solve my problem by stop the cloud-init service after provision the server. And not not start that service again. You can check with this option. If you stop the service after 1st boot then no configuration will change. Configuration will remain same as it was provisioned.

You can also create the file /etc/cloud/cloud-init.disabled. This disables running cloud-init at boot.

.. and we think this cloud-init.disabled file, a flag to beg the buggy tool from capriciously munging the network config, is a decent and long-term solution?