This project demonstrates a proof of concept (PoC) for deploying a CentOS Stream 9 virtual machine (VM) on OpenShift Virtualization using GitLab CI/CD and Ansible. The deployment utilizes the certified Kubernetes collection for Ansible from Ansible Galaxy.
Ensure the following prerequisites are met before running the project:
- OpenShift Platform 4.14 or higher
- OpenShift Virtualization
- OpenShift Storage Provider
- GitLab / GitLab Runner
- Ansible
- Kubernetes Collection from Ansible Galaxy
Warning: The
install-httpd-centos-vm.yml.j2
template contains VM credentials in plain text. This setup is intended for a proof of concept and is not secure for production environments. Use a secrets management solution to handle sensitive information securely.
-
Set Up GitLab Variables:
- Configure
OPENSHIFT_SERVER
andOPENSHIFT_TOKEN
as variables in your GitLab project settings to authenticate with OpenShift.
- Configure
-
Run the CI/CD Pipeline:
- When the pipeline is triggered, it will execute the
CreateVM
job to deploy the CentOS Stream 9 VM and install HTTPD.
- When the pipeline is triggered, it will execute the
-
Verify the Deployment:
- Check the OpenShift Virtualization console or use
oc
commands to ensure the VM is created and HTTPD is running.
- Check the OpenShift Virtualization console or use