Skip to content

deploy_vms: add cloud-init support for VM provisioning - #953

Merged
insatomcat merged 2 commits into
seapath:mainfrom
Gabin-CC:feature/cloud-init-vm-deployment
Jul 30, 2026
Merged

deploy_vms: add cloud-init support for VM provisioning#953
insatomcat merged 2 commits into
seapath:mainfrom
Gabin-CC:feature/cloud-init-vm-deployment

Conversation

@Gabin-CC

Copy link
Copy Markdown
Contributor

Summary

Adds optional cloud-init provisioning to VM deployment. Today SEAPATH only deploys and runs VMs ("does not handle any virtual machine inner configuration"); this lets a VM be configured on first boot (hostname, users, SSH keys, static network, packages, runcmd, the native ansible/ansible-pull module, ...) straight from the inventory.

Companion change in seapath/build_debian_iso ships cloud-init in the VM image and cloud-localds on the hypervisor image: link to the build_debian_iso PR

How it works

Uses the cloud-init NoCloud datasource. For each VM that defines a cloud_init mapping, a new cloud_init_seed role builds a small seed image (filesystem labelled cidata, holding meta-data / user-data / network-config) on the hypervisor with cloud-localds. The deploy roles then attach it to the VM:

  • cluster: passed to cluster_vm via additional_disks (imported by vm-manager, no vm-manager change required);
  • standalone: built in the disk pool and attached as a vdz disk in guest.xml.j2.
    cloud-init in the guest discovers the disk by its CIDATA label and applies the config on first boot.

Inventory interface

Add a cloud_init mapping to a VM to enable it. Every key is rendered as-is into the #cloud-config user-data, except the reserved keys:

Key Purpose
hostname also written to meta-data local-hostname
instance_id meta-data instance-id (defaults to the VM name)
network NoCloud network-config v2 (the version: 2 header is added)
user_data_file path to a complete user-data file, used verbatim instead of the rest

So the full cloud-config schema (users, packages, runcmd, write_files, ansible, ...) is available without per-field plumbing. See the new cloud_init_seed role README and the extended inventories/examples/seapath-vm-deployement.yaml.

Backwards compatibility

Opt-in per VM: a VM without a cloud_init block keeps the exact previous behaviour (no seed built, no extra disk).

Requirements

  • cloud-localds (cloud-image-utils) on the hypervisor — shipped by SEAPATH host images from the companion PR.
  • The base VM image must ship cloud-init.

Testing

Deploy a VM with a cloud_init block and verify inside the guest: cloud-init status --longdone, hostname / users / network applied.

@Gabin-CC
Gabin-CC force-pushed the feature/cloud-init-vm-deployment branch from b5ff2e4 to 2366c07 Compare June 18, 2026 17:41
@dupremathieu
dupremathieu requested a review from insatomcat June 23, 2026 07:23
@insatomcat
insatomcat force-pushed the feature/cloud-init-vm-deployment branch from 2366c07 to 057275a Compare June 23, 2026 08:21

@insatomcat insatomcat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really have the need for this feature, but I'd say "why not" if it's interesting to the community.
What do you think @dupremathieu

@dupremathieu

Copy link
Copy Markdown
Member

I don't really have the need for this feature, but I'd say "why not" if it's interesting to the community. What do you think @dupremathieu

It can be useful for provisioning Ubuntu VM.

@Gabin-CC
Gabin-CC force-pushed the feature/cloud-init-vm-deployment branch from 057275a to 46596d8 Compare June 24, 2026 17:22
dupremathieu
dupremathieu previously approved these changes Jun 25, 2026

@dupremathieu dupremathieu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dupremathieu

Copy link
Copy Markdown
Member

I think we should document this feature somewhere in the Wiki. @eroussy what is the best pages for that?

@eroussy

eroussy commented Jun 25, 2026

Copy link
Copy Markdown
Member

I think we should document this feature somewhere in the Wiki. @eroussy what is the best pages for that?

I would advise writing a new a subpage of this one : https://lf-energy.atlassian.net/wiki/spaces/SEAP/pages/534347789/Virtual+machines+deployment

@dupremathieu

Copy link
Copy Markdown
Member

I think we should document this feature somewhere in the Wiki. @eroussy what is the best pages for that?

I would advise writing a new a subpage of this one : https://lf-energy.atlassian.net/wiki/spaces/SEAP/pages/534347789/Virtual+machines+deployment

https://lf-energy.atlassian.net/wiki/spaces/SEAP/pages/1163329602/Cloud-init+VM+provisioning

# guest inner OS on first boot through a NoCloud seed disk. Requires the base
# image to ship cloud-init, and `cloud-localds` (package cloud-image-utils) on
# the Ansible controller. Remove this block to deploy without cloud-init.
cloud_init:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like putting this directly in the VM example inventory.
This inventory should be the a simple inventory to kick start VM deployement
Then the rest of the documentation should be in the ansible roles README
Please remove this part

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done : I removed the cloud_init block from the example inventory; the documentation and an example now live in the cloud_init_seed role README.

@Gabin-CC
Gabin-CC force-pushed the feature/cloud-init-vm-deployment branch from 9fc694e to ae79e25 Compare June 26, 2026 12:09
@Gabin-CC
Gabin-CC force-pushed the feature/cloud-init-vm-deployment branch from ae79e25 to ea9b9d9 Compare June 26, 2026 12:18
@Gabin-CC

Copy link
Copy Markdown
Contributor Author

@dupremathieu, @eroussy & @insatomcat is everything ok?

insatomcat pushed a commit that referenced this pull request Jul 28, 2026
Add an optional `cloud_init` mapping per VM to configure the guest inner
OS on first boot through a cloud-init NoCloud seed disk.

A new `cloud_init_seed` role builds the seed image (meta-data, user-data
and optional network-config) on the Ansible controller with cloud-localds.
The deploy roles then attach it to the VM:
- cluster: passed as an additional_disk imported by vm-manager;
- standalone: copied to the disk pool and attached as a vdz disk.

Every key of the `cloud_init` mapping is rendered as-is into the
#cloud-config user-data, except the reserved keys hostname, instance_id,
network and user_data_file.

The feature is opt-in per VM: VMs without a `cloud_init` key keep the
previous behaviour.

cloud-localds comes from cloud-image-utils, added to the cqfd container
image so the controller environment has the tool.

Squashed from #953.

Signed-off-by: Gabin-CC <gabin.laurent@rte-international.com>
Signed-off-by: Florent Carli <fcarli@gmail.com>
insatomcat pushed a commit that referenced this pull request Jul 28, 2026
Add an optional `cloud_init` mapping per VM to configure the guest inner
OS on first boot through a cloud-init NoCloud seed disk.

A new `cloud_init_seed` role builds the seed image (meta-data, user-data
and optional network-config) on the Ansible controller with cloud-localds.
The deploy roles then attach it to the VM:
- cluster: passed as an additional_disk imported by vm-manager;
- standalone: copied to the disk pool and attached as a vdz disk.

Every key of the `cloud_init` mapping is rendered as-is into the
#cloud-config user-data, except the reserved keys hostname, instance_id,
network and user_data_file.

The feature is opt-in per VM: VMs without a `cloud_init` key keep the
previous behaviour.

cloud-localds comes from cloud-image-utils, added to the cqfd container
image so the controller environment has the tool.

Squashed from #953.

Signed-off-by: Gabin-CC <gabin.laurent@rte-international.com>
Signed-off-by: Florent Carli <fcarli@gmail.com>
@eroussy
eroussy force-pushed the feature/cloud-init-vm-deployment branch from c5a5cfc to cea647d Compare July 29, 2026 08:45
@eroussy

eroussy commented Jul 29, 2026

Copy link
Copy Markdown
Member

@dupremathieu, @eroussy & @insatomcat is everything ok?

Hi Gabin
Looks ok to me. I'll merge that when the stack of PR/CI is free

Gabin-CC and others added 2 commits July 29, 2026 12:50
Add an optional `cloud_init` mapping per VM to configure the guest inner
OS on first boot through a cloud-init NoCloud seed disk.

A new `cloud_init_seed` role builds the seed image (meta-data, user-data
and optional network-config) on the Ansible controller with cloud-localds.
The deploy roles then attach it to the VM:
- cluster: passed as an additional_disk imported by vm-manager;
- standalone: copied to the disk pool and attached as a vdz disk.

Every key of the `cloud_init` mapping is rendered as-is into the
#cloud-config user-data, except the reserved keys hostname, instance_id,
network and user_data_file.

The feature is opt-in per VM: VMs without a `cloud_init` key keep the
previous behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Gabin-CC <gabin.laurent@rte-international.com>
The deploy_vms roles build the cloud-init NoCloud seed on the Ansible
controller with cloud-localds (provided by cloud-image-utils). Add it to
the cqfd container image so the controller environment has the tool.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Gabin-CC <gabin.laurent@rte-international.com>
@insatomcat
insatomcat force-pushed the feature/cloud-init-vm-deployment branch from cea647d to f33cfb0 Compare July 29, 2026 10:50
@insatomcat
insatomcat dismissed eroussy’s stale review July 29, 2026 14:52

"Looks ok to me. I'll merge that when the stack of PR/CI is free"

@insatomcat
insatomcat merged commit ec89e20 into seapath:main Jul 30, 2026
32 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants