Hi, i want to do a playbook that create a vm and from iso file, install the operatin system. It’s possible? Thansk
Hello,
I think a tool like hashicorp packer is better suited for this use case.
Best,
Paul
You want to check -
https://medium.com/@AbhijeetKasurde/automating-centos-7-installation-using-ansible-and-kickstart-483807a3774c
https://medium.com/8042/ansible-automating-windows-server-2012-r2-installation-in-vcenter-227577f5917c
Also see https://wiki.debian.org/DebianInstaller/Preseed and
https://www.debian.org/releases/stable/amd64/apb.en.html if you happen to be
installing Debian or Devuan. It probably works for Ubuntu as well (but I've
not tried that).
Antony.
We use Hashicorp Packer to create and maintain Windows Server and Linux VM templates. We then use those templates for server provisioning. We also use packer to maintain AWS AMIs. With packer we can ensure we offer the same source OS configurations across AWS and VMware - same OS families and versions and base configurations. For automated server provisioning this is key because it lets your provisioning workflow make assumptions across all provisioning landscapes as to what is the starting point after the template or AMI is launched. We bake into our templates and AMIs a service account that lets our provisioning process get into the new systems and do privileged tasks. Windows and Linux obviously look different, but all Linux families / versions have the same base config, and all Windows versions have the same base config.
Packer has three stages - builder, provisioner, post-processor.
- The builder stage creates the base image from an ISO (for VMware) or from an AMI (for AWS).
- The provisioner stage logs into that base image and gets it up to the expected base configuration using ansible (and some PowerShell for Windows).
- The post-processor takes the “provisioned” (configured) images and converts them to VMware templates or new AWS AMIs.
I highly recommend learning packer and using it. Learning how to do Debian Preseed or Ubuntu Cloud-Init profiles is a real mess but can be done. Red Hat Kickstart profiles are much easier to build. Windows Server requires learning how to do unattended answer files. All of this is required to master the packer build stage.
A great place to see all this as an example is Jeff Geerling’s Packer Boxes project on GitHub.
https://github.com/geerlingguy/packer-boxes
This was the basis for our Image Factory project that maintains our base VMware templates and AWS AMIs.
The vmare_guest module can easily create VMs from templates. Use packer to maintain the templates. Use Ansible to deploy servers sourcing those templates.
This is exactly what I am planning on doing very soon. I have already collection some docs to read, but I didn’t have this one. I believe that using packer will reduce overhead in managing Actual VMware Templates ( and besides has the added advantage of cloud provisioning ).
On Monday, July 18, 2022 at 10:09:28 AM UTC-7