Updated Ansible Control Server Docker Container

The Docker container I built earlier this year, when I embarked on the Infrastructure-as-Code project, has been taken and used as the base container for the internal project to automate the SDDC using Ansible. As such, most of the recent updates I have made to the container have been only published internally. I decided to spend a few minutes updating the container on the public side to take advantage of some of the improvements and changes made.

An important note, the container is not what I would call lightweight. It is intended to be used as a development container, where it can provide a base-level of libraries and binaries for running Ansible against a vSphere, vCenter or NSX-v endpoint.

The first major change I’ve made is to move where the repo lives in GitHub. I’ve broken out the repository from the virtualelephant/vsphere-kubernetes repo and placed it in the virtualelephant/containers repo (link here).

Running the container

The default CMD of the container will display the installed version of Ansible and default version of Python.

The container continues to clone several useful community Ansible modules, including vmware/nsxansible and OpenShift/ansible-ansible-contrib. I have modified the Dockerfile to copy these modules into the directory /opt/ansible/modules. The ansible.cfg file has been modified to leverage the new module location.

Another change is how the container is pulling the nsxraml spec and making it available. The container currently pulls down both the NSX-v 6.3 and 6.4 branches of the nsxraml spec and places them in /opt/nsxraml. The specs should be backwards compatible, however it is possible some future version will not be. Therefore, I have created a symlink in the container that will always point to the most recent version of the RAML spec, while leaving the other branches there in case a consumer of the container requires them.

How is this leveraged?

Well, within my Ansible dictionary variable for the nsxmanager_spec, I always point the RAML file to /opt/nsxraml/current/nsxvapi.raml.

Finally, the container includes clean-up of the git repositories reduce its size.

Learn More at VMworld

If you are going to be at VMworld, be sure to VMware {code} session  CODE5542U on Monday afternoon. I will be talking more about the internal Ansible project and will have some exciting news regarding new Ansible modules available to VMware users!

Otherwise, feel free to pull the container or the repo and leverage it based on your needs!

Enjoy!