How srekoc/cloud-infra works
Project type and purpose
• This is an infrastructure‐as‐code/devops toolchain focused on creating and cloning VMware vSphere VM images.
• It uses Packer to build a golden VM template and Terraform to provision and configure VMs in a private cloud.
• It also includes Python and shell scripts for post-provisioning operations (DNS registration via Verdad, reboot/reset via bastion hosts) and a “testing” folder for validating Terraform & Python modules.
File structure
• Top-level folders:
• packer/ – Packer JSON definitions and kickstart (ks.cfg)
• terraform/ – Terraform state, variables, main.tf, provider plugins
• python/ – post_processor.py and its README (REST API integration code)
• shell/ – helper scripts (activate, reset_vms)
• testing/ – sample .tf, .py and test harness + Terraform lock & providers
• Key config files:
• packer/centos-vsphere.json (image build spec)
• terraform/main.tf, variables.tf, terraform.tfvars (infrastructure spec)
• The presence of “.terraform” plugin directories indicates local provider plugins for vsphere, null, random.
README for additional insights
• Workflow:
1) Run Packer to create a “gold-template” VM image on vSphere.
2) Run Terraform to clone VMs from that template using the vSphere provider, assign IPs from IPAM, configure network.
3) Post-provisioning: run Python scripts to register in Verdad, then SSH to bastion for “central-push”, then reset/reboot VMs via shell scripts.
• Key dependencies: Python3 libs (urllib3, requests), Packer, Terraform CLI, vsphere creds, Verdad creds, IPAM service.
Essential architectural elements
• Terraform state file currently local (future enhancement: remote backend).
• Use of provider plugins under terraform/.terraform/providers.
• Detail the variable flow: .tfvars → main.tf/variables.tf → packer JSON variables.