Building VyOS Cloud-Init OVA?

Hi All,

I’m going through the documentation to build Cloud-Init, and there is no mentioning of building an OVA any more, it all ISO only now..

Is this correct ?

If yes, is building a Cloud-Init ISO even working, as of yesterday I have tried multiple times (non-docker) and it foes not seem to work even though the ISO is compiled successfully..

Currently I’m only checking by which cloud-init and systemctl status cloud-init but nothing appears, the command set system cloud-init is not even recognized..

Is there a proper guide to follow for an inexperienced user ?

Thank You

Im not sure what the package might be named but whats your output of:

dpkg -l | grep -i cloud

Hi @Apachez

I checked this in VyOS there is no result..

root@vyos:~# dpkg -l | grep -i cloud
root@vyos:~#

If you are compiling on your own I think you can modify:

Or perhaps better modify this one:

Into its original form:

That is besides adding cloud-init also add open-vm-tools or whatever they are called if you will run this in VMware or qemu-guest-agent if you are going to use Proxmox etc.

There is also a mention of vyos-cloud-init in:

Probably relevant aswell:

Thanks @Apachez

I’m looking to run it in VMware and was hoping to make an OVA with cloud-init, doesn’t seem so, unless I’m mistaken..

Will understand, retry with these links and see how it goes, thanks..

Its possible I might be over thinking this, the reason I need cloud-init is to pass IP address during OVA deployment, which as per Copilot ia possible via cloud-init

Is there a way for VyOS to have a script that waits to receive values post-boot, if I run a post-boot script can it receive values passed by Ansible, would know..

Thanks..

If you make a custom compile you can always adjust the default config.boot so it will be using DHCP for the MGMT-interface or just a static IP so you can connect to it and upload a custom config.boot unique for that VM-guest and then reboot it.

Excellent, I’ll test that as well..

After testing several things, I finally got it to work via OVA itself as its much more scalable..

The idea is basically to install vmtools in the VyOS, add a script to receive values from vmtools which are injected into the VM’s VMX file after OVA is deployed but before the VM powered on..

vmtools are installed below (provoided all networking is in place, it will download vmtools, run it, and run on boot as well)

sudo -i
echo "deb http://deb.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list && apt update && apt install open-vm-tools -y && systemctl enable open-vm-tools

I added the below script into a freshly installed VyOS

# Below a shell script file named onetime.sh is create in /config/scripts/ and made executable..
scriptfile=/config/scripts/onetime.sh
touch $scriptfile
chmod +x $scriptfile

# Below content is added to the shell script..
cat << 'EOF' >> $scriptfile
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template

IP_ADDR=$(vmtoolsd --cmd "info-get guestinfo.interface.0.ip")
NETMASK=$(vmtoolsd --cmd "info-get guestinfo.interface.0.netmask")

configure
set interfaces ethernet eth0 address "$IP_ADDR/$NETMASK"
commit
save

sleep 10
# Normal Bash commands will work here (commands can be added her for troubleshooting). Below I validate that the result of my command is an IP address, once confirmed its an IP address, I remove the schell script file, and the call to it in /config/scripts/vyos-postconfig-bootup.script
RUN_CHECK=$(show interfaces ethernet eth0)
IP=$(echo "$RUN_CHECK" | grep "address" | awk '{print $2}')
if [[ $IP =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}(\/[0-9]{1,2})?$ ]]; then

# Removes /config/scripts/onetime.sh from /config/scripts/vyos-postconfig-bootup.script
sed -i '\/config\/scripts\/onetime.sh/d' /config/scripts/vyos-postconfig-bootup.script

# Delete this script file itself
rm -- "$0"
fi
EOF

# Adds the script file to run to the `/config/scripts/vyos-postconfig-bootup.script`
echo $scriptfile >> /config/scripts/vyos-postconfig-bootup.script

Once this is done, I repackage it as an OVA, and deploy it via Ansible as below..

PLAYBOOK

---
- name: VyOS DEPLOYMENT
  hosts: localhost
  gather_facts: false

  tasks:
    - name: DEPLOY VyOS
      vmware_deploy_ovf:
        hostname: 192.168.30.76
        username: root
        password: password
        datastore: datastore
        validate_certs: false
        name: RTR1
        ovf: "/root/VyOS0055_2.ova"
        power_on: false   # <=== MUST REMAIN POWERED OFF AFTER DEPLOYMENT FOR VMX IJNJECTION
        networks:
          "Network 1": VM_Network
          "Network 2": VM_Network
      delegate_to: localhost

    - name: Configure Guest OS Settings
      vmware.vmware.vm_advanced_settings:   # <=== The Ansible module for configuring the VMX file
        hostname: 192.168.30.76
        username: root
        password: password
        name: RTR1
        validate_certs: false
        state: present
        settings:
          guestinfo.interface.0.ip: '192.168.30.175'   # <=== Using guestinfo.interface.0.ip under settings, these will receive the values upon boot in vmtools
          guestinfo.interface.0.netmask: '24'   # <=== Using guestinfo.interface.0.ip under settings, these will receive the values upon boot in vmtools

    - name: Power on the VM for the first time
      community.vmware.vmware_guest:
        hostname: 192.168.30.76
        username: root
        password: password
        datastore: datastore
        validate_certs: false
        name: RTR1
        state: poweredon
        wait_for_ip_address: true
      delegate_to: localhost

# The below is just to remove the values added to the VMX file
    - name: Configure Guest OS Isolation Settings
      vmware.vmware.vm_advanced_settings:
        hostname: 192.168.30.76
        username: root
        password: password
        name: RTR1
        validate_certs: false
        state: absent
        settings:
          guestinfo.interface.0.ip: '192.168.30.175'
          guestinfo.interface.0.netmask: '24'

BEFORE VMX INJECTION


AFTER VMX INJECTION


The values received can also be checked in VyOS after it boots up with the below commands

Last login: Mon Jul 27 20:33:47 2026 from 192.168.30.1
vyos@vyos:~$ sudo -i
root@vyos:~# vmtoolsd --cmd "info-get guestinfo.interface.0.ip"
192.168.30.175
root@vyos:~# vmtoolsd --cmd "info-get guestinfo.interface.0.netmask"
24
Last login: Mon Jul 27 20:33:47 2026 from 192.168.30.1
vyos@vyos:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address         MAC                VRF        MTU  S/L    Description
-----------  -----------------  -----------------  -------  -----  -----  -------------
eth0         192.168.30.175/24  00:0c:29:10:07:26  default   1500  u/u
eth1         -                  00:0c:29:10:07:30  default   1500  u/u
lo           127.0.0.1/8        00:00:00:00:00:00  default  65536  u/u
             ::1/128

We build our own VyOS ISO to include vm-tools, amongst others.