How is the cloud_init_modules stage executed?

Bug #1999781 reported by shixuantong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Invalid
Undecided
Unassigned

Bug Description

Sorry, I've been looking at the code and documentation of cloud-init recently and have a question:
How is the cloud_init_modules stage executed?

Which command does it correspond to? "cloud-init modules --mode init" or "cloud-init init".

Also, are there any modules must be defined at a certain stage(cloud_init_modules, cloud_config_modules, and cloud_final_modules)? eg.
"ca-certs" modules in cloud_init_modules stages:
https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl#L107

Can we put it in cloud_config_modules or even cloud_final_modules? If so, what's the impact? If not, why? I did not find instructions for this in the documentation.

Revision history for this message
shixuantong (sxt1001) wrote :

Sorry, I didn't know where to consult these questions, so I submitted the bug.

Revision history for this message
James Falcon (falcojr) wrote :

This page is probably the most helpful:
https://cloudinit.readthedocs.io/en/latest/topics/boot.html

Modules get run in Network, Config, and Final stages, so that's
cloud-init init
cloud-init modules --mode=config
cloud-init modules --mode=final

respectively.

Which modules get executed in which stage along with their order is defined in /etc/cloud/cloud.cfg. Modules can be enabled/disabled/reordered as desired, but that could cause system instability as later modules may rely on something executed earlier (e.g., running mounts before disk_setup probably doesn't make much sense). We don't define any hard requirements between modules though. If moving things works for your use case, then do what works for you. Just know that the upstream ordering is the tested and supported configuration, and we can't guarantee that anything outside of that will work properly.

You'll notice that in https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl, distros modify which modules get run and their order for their particular distro.

I'm going to mark this bug invalid as it isn't actually a bug, but we can continue the conversation here if I didn't answer your question. We do have a #cloud-init channel on Libera IRC for chat, a discourse (https://discourse.ubuntu.com/c/server/cloud-init/54) for something resembling a message board, and cloud-init mailing list (https://lists.launchpad.net/cloud-init/). Those would all be better places to ask questions, and you'd probably get responses quicker.

Changed in cloud-init:
status: New → Invalid
Revision history for this message
shixuantong (sxt1001) wrote :

ok,thanks

Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.