First experience with VMware and Ansible

After I started to work with VMware, I got more and more interested in how to automate all the manual tasks. So I looked around on the internet and found two possibilities. On the one hand with Powershell and on the other hand with Ansible. Since Ansible has always interested me, I set out on a journey to learn it.
As with any new tool, getting started is always the hardest, but it’s even more fun to see success afterwards. Here I describe my findings on how to use Ansible with VMware.

Installation

To be able to work with Ansible, it is recommended to use a Linux machine, because all the tools are easier to install there. For the installation of Ansible I always use virtual environments, so that I can work with different versions without them getting in each other’s way. Since Ansible is based on Python, I use venv as a virtual environment.

 

The picture above shows how I created the virtual environment. Now only the associated packages are missing. So first you have to install ansible-core and pyvmomi. Additionally it is also important to install the corresponding Ansible modules. Ansible manages all additional modules via Ansible Galaxy.

As shown in the image above, I have downloaded the appropriate module. In the case of VMware, I have downloaded the community module here. With this, all requirements are now met and we can now use Ansible.

Using Ansible

Here is an example of what an Ansible-Playbook might look like. For me it was important to get everything working first. Next I will focus on deepening my knowledge of Ansible and maybe write a new blog about it.

Kommentar absenden

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert