Using latest cloud image for vagrant box:
http://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-Vagrant-Vbox.latest.x86_64.box
Trying cloud-init the image and not working with error cloud-init is not found. ...
Tested with Ubuntu box and working OK:
config.vm.box = “jammy-server-cloudimg-amd64-vagrant”
config.vm.box_url = “https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-vagrant.box”
Below the files and the error:
Vagrantfile
Vagrant.configure("2") do |config|
config.env.enable
config.vm.define "test1"
config.vm.box = "rocky-9-Vagrant-VBox-x86_64"
config.vm.box_url = "http://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-Vagrant-Vbox.latest.x86_64.box"
config.vm.provider "virtualbox" do |v|
v.name = "rocky-9-test1"
end
# cloud-init script
config.vm.cloud_init do |cloud_init|
cloud_init.content_type = "text/cloud-config"
cloud_init.path = "cloud-init-test1.yml"
end
end
,env
VAGRANT_EXPERIMENTAL="cloud_init,disks"
cloud-init-test1.yml
#cloud-config
chpasswd:
list: |
root:test
expire: False
And this is the error:
$ vagrant up
==> vagrant: You have requested to enabled the experimental flag with the following features:
==> vagrant:
==> vagrant: Features: cloud_init, disks
==> vagrant:
==> vagrant: Please use with caution, as some of the features may not be fully
==> vagrant: functional yet.
Bringing machine 'test1' up with 'virtualbox' provider...
==> test1: Box 'rocky-9-Vagrant-VBox-x86_64' could not be found. Attempting to find and install...
test1: Box Provider: virtualbox
test1: Box Version: >= 0
==> test1: Box file was not detected as metadata. Adding it directly...
==> test1: Adding box 'rocky-9-Vagrant-VBox-x86_64' (v0) for provider: virtualbox
test1: Downloading: http://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-Vagrant-Vbox.latest.x86_64.box
==> test1: Box download is resuming from prior download progress
==> test1: Successfully added box 'rocky-9-Vagrant-VBox-x86_64' (v0) for 'virtualbox'!
==> test1: Importing base box 'rocky-9-Vagrant-VBox-x86_64'...
==> test1: Matching MAC address for NAT networking...
==> test1: Setting the name of the VM: rocky-9-test1
==> test1: Clearing any previously set network interfaces...
==> test1: Preparing network interfaces based on configuration...
test1: Adapter 1: nat
==> test1: Forwarding ports...
test1: 22 (guest) => 2222 (host) (adapter 1)
==> test1: Preparing user data for cloud-init...
==> test1: Configuring storage mediums...
==> test1: Booting VM...
==> test1: Waiting for machine to boot. This may take a few minutes...
test1: SSH address: 127.0.0.1:2222
test1: SSH username: vagrant
test1: SSH auth method: private key
test1:
test1: Vagrant insecure key detected. Vagrant will automatically replace
test1: this with a newly generated keypair for better security.
test1:
test1: Inserting generated public key within guest...
test1: Removing insecure key from the guest if it's present...
test1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> test1: Machine booted and ready!
cloud-init is not found. Please ensure that cloud-init is installed and
available on path for guest 'test1'.