cloud,

Ansible for VMware

Follow · 2 mins read
Share this

Ref: VMware Guide for Ansible

Ansible VMware modules are written on top of pyVmomi which is the Python SDK for the VMware vSphere API that allows user to manage ESX, ESXi, and vCenter infrastructure.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py

$ pip install pyvmomi

1.1. vmware_guest module

The vmware_guest module manages various operations related to virtual machines in the given ESXi or vCenter server.

1.1.1. Installing vCenter SSL certificates for Ansible

From any web browser, go to the base URL of the vCenter Server without port number like https://vcenter-domain.example.com Click the “Download trusted root CA certificates” link at the bottom of the grey box on the right and download the file. Change the extension of the file to .zip. The file is a ZIP file of all root certificates and all CRLs. Extract the contents of the zip file. The extracted directory contains a .certs directory that contains two types of files. Files with a number as the extension (.0, .1, and so on) are root certificates. Install the certificate files are trusted certificates by the process that is appropriate for your operating system.

1.1.2. Installing ESXi SSL certificates for Ansible

Enable SSH Service on ESXi either by using Ansible VMware module vmware_host_service_manager or manually using vSphere Web interface. SSH to ESXi server using administrative credentials, and navigate to directory /etc/vmware/ssl Secure copy (SCP) rui.crt located in /etc/vmware/ssl directory to Ansible control node. Install the certificate file by the process that is appropriate for your operating system.

2. Appendix

2.1. VMWware Templates

https://www.nakivo.com/blog/vm-templates-a-to-z/

2.2. Enable custom scripts in vmware-tools

vmware-toolbox-cmd config set deployPkg enable-custom-scripts true

Ref: Create a Customization Specification for Linux

2.3. vCenter Simumlator Container

Latest Stories

How To Get Hands-On Experience in AWS

Every Time you have the same situation, you know the technology and maybe you are already a certified professional in that technology, but you are not getting enough hands-on on that ...

In AWS, Jan 04, 2021
Getting Started with Ansible Collections

Ansible Collection is a great way of getting content contributions from various Ansible Developers. Earlier there was a tagline for Ansible – “Batteries included”, but now the battery...

In redhat, ansible, Dec 22, 2020
Configure Your Windows Host to be Managed by Ansible

I was talking to my friend about Ansible automation and how we are implementing automated solutions for cloud and on-premise infrastructure. Then he told me that, his team is looking ...

In redhat, ansible, Dec 01, 2020
Remove nodes from Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. You can manage full-lifecycle of Kubernetes clusters...

In containers, kubernetes, Nov 30, 2020
Adding new nodes to Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. Learn how to add new nodes in a Kubernetes cluster u...

In containers, kubernetes, Nov 27, 2020

Featured