I assume you have a Virtual Macine with CentOS 8 installed and want to make it ready for cloud-init:
Login as root user and check the status of the selinux via command
setatus
In case like above it is enabled then edit the file /etc/sysconfig/selinux, then disable the selinux.
Reboot the machine and check it again via sestatus, it mus be disabeld
yum install -y cloud-init
yum install -y perl
Create a file for network configuration and input : network: {config: disabled}
This will configure cloud init to skip the network configuration
vi /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
Press shift + zz to save the document, issue the following command
cloud-init clean
then shutdown the machine via :
init 0
Go to the properties of VM, and configure the CD/DVD like below
At the end convert the VM to the Template.