VMware Cloud and Multi mode Ansible - New Use case

Ansible has become the most popular automation tool in the cloud. When it comes to a cloud service provider, there are major challenges that prevent utilising Ansible to its full potential.


The challenge will be more evident for a managed cloud service provider who host hundreds to thousands of customer network silos as below:




What options does a VMware cloud service provider have?
  1. Configure physical/virtual firewalls and VPNs to allow Ansible traffic (very high management overhead)
  2. Use Ansible pull mode (potentially simpler network setup than Option 1)
  3. Add a backdoor network to each VM (massive security loophole, although it can mitigated by VMware distributed firewall)
All three options are not ideal in minimising network complexity while maintaining security. Hang on, there is a brilliant tool from VMware – Guest Operations API, that can copy files into/from VM guests, and execute commands. The Guest Operations made it possible to achieve everything inside VM guests by connecting to vCenter, and no access to tenant networks will be required because the traffic goes through vCenter!
However, Ansible speaks the language of SSH and WinRM, not Guest Operations. How to leverage Ansible to configure VMs through Guest Operations? There is a simple yet elegant way – build a command proxy in the middle that can serve as SSH server or WinRM server. At the other end, it calls Guest Operations to configure VM guests and return results to Ansible.
Architecture
During the development of the command proxy for WinRM, one can attempt to understand how Ansible speaks with a Windows server by observing the TCP streams using Wireshark. Then decode the PowerShell code sent by Ansible, finally a simulated WinRM server can be built work with Ansible.
The sequence diagram shows how the 3 components (Ansible, Command Proxy, Windows Server) work together. Note that it is not a complete implementation of WinRM protocols, but it is sufficient to work with Ansible.
WinRM_Impl
And here is what it looks like from Ansible, note that it is successful in gathering facts and making changes.
Ansible_View

Final Word

It is a complex endeavor to manage multiple tenants as a VMware cloud provider. This article made it possible to manage VMs centrally without getting involved in complex networking. Hope this will help people finding a different route in managing servers without compromising security.
Wanting to try running code inside VM guests, but you are not familiar with web APIs? Don’t worry, VMware provided PowerCLI that can utilise Guest Operations in one liner. It can be easily incorporated into .NET Core and run in containers.

Comments

Post a Comment

Popular posts from this blog

Installing Ansible on Red Hat Linux

Successful Implementation - VMWare SDDC implementation using autonomus process