Is using Terraform, Ansible, and cloud-init together overkill for VM setup?

0
25
Asked By CuriousCat99 On

I'm trying to set up a workflow where I use Terraform to deploy a VM, cloud-init for basic configuration, and then Ansible to install all the necessary content inside the VM. I might even pull the Ansible playbook from a Git repository and run it locally within the VM. Is this a common approach for customizing VM deployments, or is it a bit excessive with all these different technologies involved? I'm pretty comfortable with each of them, but I want to know if combining them this way is sensible or over-engineered.

6 Answers

Answered By DevOpsDynamo On

It's pretty common to use those tools together, but I recommend skipping the reboot and prepping your images with Packer first. The VM can come up ready to bootstrap, with cloud-init launching Ansible (or Chef, if you prefer) to get everything up and running.

Answered By TechWizard42 On

What I’ve done before is use Packer to build the VM and handle most of the configurations with Ansible. Then, Terraform deploys the image with custom cloud-init scripts to finalize everything. This way, the startup is much quicker than configuring it all afterwards.

Answered By CloudCrafter88 On

Yes, that’s how we operate! Terraform provisions EC2 instances alongside a userdata script. This script is minimal, just enough to clone our Ansible playbook and kick things off. Ansible then handles all the heavy lifting for server configuration.

Answered By SimplifyGuru On

I think Ansible might be unnecessary for what you’re aiming to do. Many folks manage to get their VMs configured just fine with init scripts that Terraform can run. The issue with cloud-init is rebooting during installations can be tricky; Ansible really shines there since it can resume post-reboot.

Answered By SetupSage On

If you’re looking for a general VM deployment process: Packer creates a basic template (like setting up the user and SSH keys), then Terraform handles the deployment. Ansible will configure the VM, and consider initiating it as a resource from Terraform while passing bootstrap variables. Trust me, don’t mess with IPs in Terraform directly; I learned that the hard way!

Answered By ImageMaster101 On

Using Packer to create customized images and Terraform for provisioning sounds ideal. Ansible should play a role in runtime configuration management for operational tasks.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.