Lets use Ansible to make use of Packer and VMware!

As I venture on to the path of Continuous Delivery, I have found Packer to be an awesome tool to build an immutable image.

One of the cool features you can expect is an up-to-date operating system with all the pre-installed packages/software ready to be used.

Packer is also flexible with your preferred builder or post-processor. An example would be creating an Amazon Machine Image (AMI) or VMware Virtual Machine with a very similiar Packer template.



Feel free to view my Centos 7 Minimal Build here:

https://github.com/justai-net/packer-centos-7-minimal.git

Module of Choice

vmware_guest: http://docs.ansible.com/ansible/latest/vmware_guest_module.html

Requirements

Ansible => 2.4.3.0

PyVmomi - Python SDK for VMware vSphere API that allows you to manage ESX, ESXi, and vCenter:

https://github.com/vmware/pyvmomi

https://github.com/vmware/pyvmomi VMware vCenter, VMware ESXi

vmware-tools installed on virtual machine template

Perl (for VMware's guest customization) for virtual machine template, not installed by default on RHEL 7 minimal, Centos 7 Minimal

Let's Deploy

Let's get started on building a Web Server (Nginx) and a Database (MySQL)!

Here are the following parameters we will be supplying to a VMware vCenter host, utilising a Centos7 template: