Maintaining a template vm or entirely from playbook?

I will soon be tasked with deploying a virtual machine into several different datacenters/clusters with the same application. The only thing that really should change is the network bindings for public internet access and private networking.

My initial thought was to manually create a VM, configure networking, install the application and services, setup an ansible user in sudoers, etc, then convert to template and upload template to the master content library (all other vcenters subscribe to the master) - then pull it down manually in each vcenter/cluster that is needed, then run an ansible playbook to clone a vm from template, reconfigure where needed.

Or, option B:

Have a monolithic playbook or use a role to deploy a fresh vm, install OS (or perhaps use a blank os installed template), run each command to configure networking, install application, configure, etc.

First method I think will save some time but involves curating an artifact I believe (not a devops person).

Is there an accepted practice here?

Short answer, no, there is no accepted answer - it is entirely dependent on your philosophy and long-term maintenance preferences.

It’s an old and common decision - 1, use images to build new servers; or 2, install fresh. It even pre-dates VMs & cloud computing - back in the day with physical servers you could use an imaging program like Ghost.

Personally, I go with fresh install every time - so maintaining an install script (or in ansible, a playbook). This is born of years of trying both, and ultimately comes down to 2 reasons:

  1. I worked with Windows for many years, and it wasn’t really simple to use images, especially with windows applications. So there ended up being a ton of post-imaging scripts that had to be run anyway
  2. In my experience, managing an image is way more complicated than an install script.

But that’s me, you may think differently.

Good luck!

3 Likes

Thank you for the response. That makes sense for sure. Turns out, this application is popular enough to be sitting in ansible galaxy so I won’t even have to re-invent the wheel.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.