CX Solution Deployment using IAC
Overview
Infrastructure as Code (IaC) is the process of managing and provisioning infrastructure using machine-readable configuration files instead of manual setup.
In the past, creating a virtual machine (VM) and deploying a CX solution was a slow and manual process. The team had to log in to the VMware vSphere portal, manually configure VM settings like CPU, RAM, and disk space, and install the operating system by hand. Once the VM was created, engineers had to SSH into the machine and install Kubernetes, configure storage, and deploy the application components manually—one by one. This process could take several hours, and if a mistake was made (like assigning the wrong IP or missing a step), the entire process had to be restarted. Also, there was no version control, which meant no easy way to track changes, reuse setups, or collaborate properly across teams.

Terraform is an Infrastructure as Code (IaC) tool used to automate infrastructure deployment on any cloud or on-premises environment. With Terraform, you can create an Ubuntu 22.04 VM in vSphere using a Packer template. The VM can be created within seconds and destroyed when no longer needed.
Ansible is a configuration management tool used to automate application setup and system configuration. It helps with tasks like:
Installing RKE2 with the latest version (v1.31.3+rke2r1)
Setting up a storage solution (OpenEBS)
Deploying Helm-based CX solutions
Life Cycle of CI Pipeline
The CI pipeline executes the following steps in sequence
Format Check ---> Plan ---> Apply ---> Destroy
The first step is to check the format of the terraform files. If the format is correct, the next step is to plan the creation of VM. If the plan is successful, the next step is to apply the plan and create the VM. The last step is to destroy the VM. If you are required to create a new virtual machine, just create a branch with the certain name and run pipelines on it.
Specific Template:
"/^UX.-./"
"/^CORE.-./"
"/^BI.-./"
"/^QA.-./"
"/^studio.-./"
"/^RM.-./"
"/^AI.-./"
Steps to Run the Pipeline
Create a Branch From release branches which you need to deploy i.e. “CX-4.9” on IAC Project with the specific template. which mentioned above.
On the left sidebar, select Build and then select Pipelines.
On right top corner, look for blue button, Run Pipelines
Select branch you have created. If you have not created a branch, create a new branch. For every new VM, you must create a new branch.
you can override the default values of these variable. These are the properties of the new VM that is going to be created.
IaC accept individual version parameters for all CX Helm charts. Charts are installed using the specified versions. You need to put charts version according to the specific release.
Mandatory charts (
Agent Desk
,CX Core
,Channels
) are always deployed.Optional charts (
Reporting
, Eleveo, Survey,Campaign
,CiscoScheduler, Clamav ) are deployed only if explicitly enabled by user input. enter true deploy the chart if enter false then skip the chart.provide a unique name and ip address. You can also tweak the other properties such as Datastore, CPU, RAM, DISK , Branch. Resources must be allocated in proportion, such as in a 1:2 ratio.
Please update the
BRANCH
variable with the branch name you want to clone.Only update the
BACKUP_BRANCH
variable when you need a backup. Then, change theBACKUP_BRANCH
variable to the branch name from which you want the backup.This is the branch URL: https://gitlab.expertflow.com/cim/iac-backup/. First, create a branch here, then store the PostgreSQL and MongoDB backup there. After that, update the
BACKUP_BRANCH
variable with the name of that branch.


After re-populating the variables, click on Run Pipeline on the left bottom corner.
This is the manual job, so the first stage,
fmt
will need to be run manually. To do this, click on play button onfmt
job and wait for the process to reach todeploy
job. Once the control reached todeploy
job, then the next configure job using ansible playbook configure the rke2, set the storage solution and deploying CX Solution.That's it. Your VM will be created in few minutes.
After this pipeline runs successfully, you can access it using its unique IP Address, username: root, and password: Expertflow123.
Backup Restore:
ansible-manual job is a manual job which is trigger only when you need to take backup of a Mongodb and Postgresql.
You will manually trigger this job only when a backup is needed. Otherwise, your VM will be created, and the solution will be deployed through Ansible configuration.

Destroy VM with Gitlab UI
To destroy the VM, you must run the next job with title
destroy
. The VM will be destroyed in few minutes.
Related Documents
https://expertflow-docs.atlassian.net/wiki/x/9Y2yMQ
Mongo, PostgreSQL Backup/Restore Procedure for EF-CX on Kubernetes ( manual procedure )