I’ve been going through Ansible training for work, and I want to be able to easily try out some of the playbooks and modules on my Windows 10 box. There’s lots of ways I could go about this, but for me the thing that makes the most sense is to leverage Docker for Windows (DfW) and the magic of containers to be able to get up and running quickly. In this post I will walk through what I did to get started, and why I landed on containers instead of another solution.
At my day job, we are working on building demos for our HPE Synergy system using Ansible for automation. Obviously, in order to run the demos I need something that can run Ansible playbooks and has access to the API endpoint for the OneView Composer that manages the Synergy frame. I’ve used Ansible before for some small projects and in my Deep Dive Terraform course on Pluralsight. In those cases, I was creating a Linux host and having it run the Ansible playbooks on itself, so I didn’t need a traditional controller node. In the case of OneView, I now need a controller node that can reach out to a system and configure it via API calls.
I am also going through Ansible training, and while Red Hat does provide a lab environment, I also want a local instance I can try things out on.
I reviewed my options for a local instance and here’s what I came up with:
And so DfW FTW as it were!
If you’d like to do the same, first you need to install DfW. You will also need to install the Hyper-V and Containers features in Windows, which DfW will do for you if you haven’t already. Once DfW is installed, go ahead and clone my GitHub repo for this project. You can build the docker image using:
docker build -t centos7-ansible-oneview .
And then spin up a container using:
docker run -it centos7-ansible-oneview /bin/bash
If you happen to be trying to use this for your own OneView and Synergy install, then definitely take a look at the additional requirements HPE has listed on their GitHub repo for Ansible and Terraform. As I work through the demo process, I will try to update this post and the Dockerfile with additional configuration to make the process as seamless as possible.
October 18, 2024
What's New in the AzureRM Provider Version 4?
August 27, 2024
Debugging the AzureRM Provider with VSCode
August 20, 2024
State Encryption with OpenTofu
August 1, 2024