Ansible has a number of modules for managing VMware infrastructure, including datacenter, cluster, host system, and virtual machine management.
pyVmomi is the foundation for Ansible VMware modules. pyVmomi is the Python SDK for the VMware vSphere API which allows users to manage their ESX, ESXi, and vCenter infrastructure. You may install pyVmomi with pip (depending on your OS/distro, you may require pip3):
pip install pyvmomi
Ansible VMware modules leveraging latest vSphere features are using vSphere Automation Python SDK. You can install vSphere Automation Python SDK using pip:
pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git
Ansible for VMware Concepts
Some of these concepts apply to all Ansible usage, including VMware automation, while others are unique to VMware. To utilize Ansible for VMware automation, you must first understand them.
1. Control Node
Control Node is any machine with a Ansible installed on it. You can run commands and playbooks, invoking /usr/bin/ansible or /usr/bin/ansible-playbook, from any control node. You can have multiple control nodes.
2. Delegation
Delegation allows you to select the system that executes a given task. If you do not have pyVmomi installed on your control node, use the delegate_to keyword on VMware-specific tasks to execute them on any host where you have pyVmomi installed.
3. Modules
The units of code Ansible executes. Each module has a particular use, from creating virtual machines on vCenter to managing distributed virtual switches in the vCenter environment. You can invoke a single module with a task, or invoke several different modules in a playbook.
4. Playbooks
Ordered lists of tasks, saved so you can run those tasks in that order repeatedly. Playbooks can include variables as well as tasks. Playbooks are written in YAML and are easy to read, write, share and understand.
Most of the admins are using Ansible these days to automate the VMware Infrastructure. Using Ansible with VMware allows you to enable a self-service IT Model across all environments making it possible to do more with what you already have.
With this I'll wrap up this post here.
Thank you for reading!
*** Explore | Share | Grow ***
Comments